cleanup and bugfixes
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Sun, 17 Oct 2021 21:24:15 +0000 (16:24 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Sun, 17 Oct 2021 21:24:15 +0000 (16:24 -0500)
core/alloc/heap.onyx
docs/todo

index 73bd017aee4b3d75b94124e0575fd9c4e2ef2fc1..b15d4ce2fb3014b50df5477fe99ee7eaddc8ef6a 100644 (file)
@@ -14,7 +14,9 @@ Enable_Debug :: false
 #load "core/intrinsics/wasm"
 
 #if runtime.Multi_Threading_Enabled {
-    heap_mutex: sync.Mutex;
+    sync :: package core.sync
+    
+    heap_mutex: sync.Mutex
 }
 
 init :: () {
@@ -42,7 +44,6 @@ get_watermark :: () => cast(u32) heap_state.next_alloc;
     memory  :: package core.memory
     math    :: package core.math
     runtime :: package runtime
-    sync    :: package core.sync
 
     uintptr :: #type u32
 
@@ -191,7 +192,7 @@ get_watermark :: () => cast(u32) heap_state.next_alloc;
 
     heap_resize :: (ptr: rawptr, new_size_: u32, align: u32) -> rawptr {
         if ptr == null do return null;
-        
+
         #if runtime.Multi_Threading_Enabled {
             sync.scoped_mutex(^heap_mutex);
         }
index 11e007d11caaabc924ac63a52434ee1bef3f24dd..d207a0078073f7909c6badeed8dad7d017017ff0 100644 (file)
--- a/docs/todo
+++ b/docs/todo
@@ -186,8 +186,8 @@ To-Do list for threading capability in the browser:
     [X] Change initialization process for main thread / worker threads
         - _thread_start
     [X] Write the JS glue code that will ship with the multi-threaded binary
-    [ ] Write basic threading primatives like mutex and semaphore
-    [ ] Make heap and printf take a mutex
+    [X] Write basic threading primatives like mutex and semaphore
+    [X] Make heap and printf take a mutex
 
     [ ] LATER: add thread-local variables
         - Have a new global that is the TLS base pointer