From: Brendan Hansen Date: Sun, 17 Oct 2021 21:24:15 +0000 (-0500) Subject: cleanup and bugfixes X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=59513d2bd3cc5d1b4988c2966fedf002f6aa9173;p=onyx.git cleanup and bugfixes --- diff --git a/core/alloc/heap.onyx b/core/alloc/heap.onyx index 73bd017a..b15d4ce2 100644 --- a/core/alloc/heap.onyx +++ b/core/alloc/heap.onyx @@ -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); } diff --git a/docs/todo b/docs/todo index 11e007d1..d207a007 100644 --- 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