__stdio_init();
}
+_thread_start :: (id: i32, tls_base: rawptr, func: (data: rawptr) -> void, data: rawptr) {
+ __tls_base = tls_base;
+ context.thread_id = id;
+
+ __stack_top = raw_alloc(alloc.heap_allocator, 1 << 20);
+ __thread_initialize();
+
+ func(data);
+
+ __flush_stdio();
+}
+
+_thread_exit :: (id: i32) {
+ raw_free(alloc.heap_allocator, __tls_base);
+
+ thread.__exited(id);
+}
__spawn_thread :: (id: i32, tls_base: rawptr, func: (data: rawptr) -> void, data: rawptr) -> bool #foreign "host" "spawn_thread" ---
__kill_thread :: (id: i32) -> i32 #foreign "host" "kill_thread" ---
- #export "_thread_start" (id: i32, tls_base: rawptr, func: (data: rawptr) -> void, data: rawptr) {
- __tls_base = tls_base;
- context.thread_id = id;
-
- __stack_top = raw_alloc(alloc.heap_allocator, 1 << 20);
- __thread_initialize();
-
- func(data);
-
- __flush_stdio();
- }
-
- #export "_thread_exit" (id: i32) {
- raw_free(alloc.heap_allocator, __tls_base);
-
- thread.__exited(id);
- }
+ #export "_thread_start" _thread_start
+ #export "_thread_exit" _thread_exit
}
__spawn_thread :: (id: i32, tls_base: rawptr, func: (data: rawptr) -> void, data: rawptr) -> bool #foreign "env" "spawn_thread" ---
__kill_thread :: (id: i32) -> i32 #foreign "env" "kill_thread" ---
- #export "_thread_start" (id: i32, tls_base: rawptr, func: (data: rawptr) -> void, data: rawptr) {
- __tls_base = tls_base;
- context.thread_id = id;
-
- __stack_top = raw_alloc(alloc.heap_allocator, 1 << 20);
- __thread_initialize();
-
- func(data);
-
- __flush_stdio();
- }
-
- #export "_thread_exit" (id: i32) {
- raw_free(alloc.heap_allocator, __tls_base);
-
- thread.__exited(id);
- }
+ #export "_thread_start" _thread_start
+ #export "_thread_exit" _thread_exit
}