Disable var and const declarations

This commit is contained in:
Ginger Bill
2017-06-28 23:17:20 +01:00
parent 9ca2246bac
commit 0622509807
27 changed files with 2508 additions and 2537 deletions
+5 -5
View File
@@ -49,7 +49,7 @@ proc mutex_destroy(m: ^Mutex) {
semaphore_destroy(&m._semaphore);
}
proc mutex_lock(m: ^Mutex) {
var thread_id = current_thread_id();
thread_id := current_thread_id();
if atomics.fetch_add(&m._counter, 1) > 0 {
if thread_id != atomics.load(&m._owner) {
semaphore_wait(&m._semaphore);
@@ -59,11 +59,11 @@ proc mutex_lock(m: ^Mutex) {
m._recursion++;
}
proc mutex_try_lock(m: ^Mutex) -> bool {
var thread_id = current_thread_id();
thread_id := current_thread_id();
if atomics.load(&m._owner) == thread_id {
atomics.fetch_add(&m._counter, 1);
} else {
var expected: i32 = 0;
expected: i32 = 0;
if atomics.load(&m._counter) != 0 {
return false;
}
@@ -76,8 +76,8 @@ proc mutex_try_lock(m: ^Mutex) -> bool {
return true;
}
proc mutex_unlock(m: ^Mutex) {
var recursion: i32;
var thread_id = current_thread_id();
recursion: i32;
thread_id := current_thread_id();
assert(thread_id == atomics.load(&m._owner));
m._recursion--;