bugfix with context not being initialized yet
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 18 Oct 2021 00:49:35 +0000 (19:49 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 18 Oct 2021 00:49:35 +0000 (19:49 -0500)
core/runtime/js.onyx
core/threads/thread.onyx

index 18f3e18ad9bab964c77fc86edaa7fac932edc6ec..2ad858d7a896aa604aa4d96ac67c663e34b8aca6 100644 (file)
@@ -22,7 +22,7 @@ __exit          :: (status: i32) -> void #foreign "host" "exit" ---
     __spawn_thread :: (id: i32, func: (data: rawptr) -> void, data: rawptr) -> bool #foreign "host" "spawn_thread" ---
 
     #export "_thread_start" (func: (data: rawptr) -> void, data: rawptr) {
-        __stack_top = raw_alloc(context.allocator, 1 << 20);
+        __stack_top = raw_alloc(alloc.heap_allocator, 1 << 20);
         __thread_initialize();
 
         func(data);
@@ -32,7 +32,7 @@ __exit          :: (status: i32) -> void #foreign "host" "exit" ---
 
     #export "_thread_exit" (id: i32) {
         // raw_free(context.allocator, __stack_top);
-        raw_free(context.allocator, __tls_base);
+        raw_free(alloc.heap_allocator, __tls_base);
 
         thread.__exited(id);
     }
index c45973623f19ab5fa85537aead0b79a71b375c98..8ee99cb676bbdcc1b3f1fb427e485b5e79e6e327 100644 (file)
@@ -43,7 +43,7 @@ __exited :: (id: i32) {
     if thread != null {
         thread.alive = false;
         __atomic_notify(^thread.id);
-        
+
         thread_map->delete(id);
     }
 }