aboutsummaryrefslogtreecommitdiff
path: root/core/sync_linux.odin
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-06-28 23:47:06 +0100
committerGinger Bill <bill@gingerbill.org>2017-06-28 23:47:06 +0100
commit94afcec7577f24d7f027f72765928e6dc5738234 (patch)
tree3928353bd29c2d6b9f501243edf1fed52bf320c9 /core/sync_linux.odin
parent4f28e9e1fbc1d2a61c3996b2813214e2344e7e6a (diff)
:: style procedure declarations; remove old parsing code
Diffstat (limited to 'core/sync_linux.odin')
-rw-r--r--core/sync_linux.odin22
1 files changed, 11 insertions, 11 deletions
diff --git a/core/sync_linux.odin b/core/sync_linux.odin
index 2ceb9520e..5874c70f0 100644
--- a/core/sync_linux.odin
+++ b/core/sync_linux.odin
@@ -14,41 +14,41 @@ Mutex :: struct {
_recursion: i32,
}
-proc current_thread_id() -> i32 {
+current_thread_id :: proc() -> i32 {
return i32(os.current_thread_id());
}
-proc semaphore_init(s: ^Semaphore) {
+semaphore_init :: proc(s: ^Semaphore) {
// s._handle = win32.CreateSemaphoreA(nil, 0, 1<<31-1, nil);
}
-proc semaphore_destroy(s: ^Semaphore) {
+semaphore_destroy :: proc(s: ^Semaphore) {
// win32.CloseHandle(s._handle);
}
-proc semaphore_post(s: ^Semaphore, count: int) {
+semaphore_post :: proc(s: ^Semaphore, count: int) {
// win32.ReleaseSemaphore(s._handle, cast(i32)count, nil);
}
-proc semaphore_release(s: ^Semaphore) #inline {
+semaphore_release :: proc(s: ^Semaphore) #inline {
semaphore_post(s, 1);
}
-proc semaphore_wait(s: ^Semaphore) {
+semaphore_wait :: proc(s: ^Semaphore) {
// win32.WaitForSingleObject(s._handle, win32.INFINITE);
}
-proc mutex_init(m: ^Mutex) {
+mutex_init :: proc(m: ^Mutex) {
atomics.store(&m._counter, 0);
atomics.store(&m._owner, current_thread_id());
semaphore_init(&m._semaphore);
m._recursion = 0;
}
-proc mutex_destroy(m: ^Mutex) {
+mutex_destroy :: proc(m: ^Mutex) {
semaphore_destroy(&m._semaphore);
}
-proc mutex_lock(m: ^Mutex) {
+mutex_lock :: proc(m: ^Mutex) {
thread_id := current_thread_id();
if atomics.fetch_add(&m._counter, 1) > 0 {
if thread_id != atomics.load(&m._owner) {
@@ -58,7 +58,7 @@ proc mutex_lock(m: ^Mutex) {
atomics.store(&m._owner, thread_id);
m._recursion++;
}
-proc mutex_try_lock(m: ^Mutex) -> bool {
+mutex_try_lock :: proc(m: ^Mutex) -> bool {
thread_id := current_thread_id();
if atomics.load(&m._owner) == thread_id {
atomics.fetch_add(&m._counter, 1);
@@ -75,7 +75,7 @@ proc mutex_try_lock(m: ^Mutex) -> bool {
m._recursion++;
return true;
}
-proc mutex_unlock(m: ^Mutex) {
+mutex_unlock :: proc(m: ^Mutex) {
recursion: i32;
thread_id := current_thread_id();
assert(thread_id == atomics.load(&m._owner));