Remove context.thread_id

This commit is contained in:
gingerBill
2021-06-08 15:57:00 +01:00
parent f19bb0f4d4
commit 8ec2ca9dcd
14 changed files with 58 additions and 32 deletions
+3 -3
View File
@@ -201,7 +201,7 @@ Recursive_Benaphore :: struct {
}
recursive_benaphore_lock :: proc(b: ^Recursive_Benaphore) {
tid := runtime.current_thread_id();
tid := current_thread_id();
if atomic_add_acquire(&b.counter, 1) > 1 {
if tid != b.owner {
sema_wait(&b.sema);
@@ -213,7 +213,7 @@ recursive_benaphore_lock :: proc(b: ^Recursive_Benaphore) {
}
recursive_benaphore_try_lock :: proc(b: ^Recursive_Benaphore) -> bool {
tid := runtime.current_thread_id();
tid := current_thread_id();
if b.owner == tid {
atomic_add_acquire(&b.counter, 1);
}
@@ -228,7 +228,7 @@ recursive_benaphore_try_lock :: proc(b: ^Recursive_Benaphore) -> bool {
}
recursive_benaphore_unlock :: proc(b: ^Recursive_Benaphore) {
tid := runtime.current_thread_id();
tid := current_thread_id();
assert(tid == b.owner);
b.recursion -= 1;
recursion := b.recursion;