mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
Disable var and const declarations
This commit is contained in:
+7
-7
@@ -2,7 +2,7 @@
|
||||
// Inline vs external file?
|
||||
|
||||
import win32 "sys/windows.odin" when ODIN_OS == "windows";
|
||||
var _ = compile_assert(ODIN_ARCH == "amd64"); // TODO(bill): x86 version
|
||||
_ := compile_assert(ODIN_ARCH == "amd64"); // TODO(bill): x86 version
|
||||
|
||||
|
||||
proc yield_thread() { win32.mm_pause(); }
|
||||
@@ -34,8 +34,8 @@ proc fetch_or(a: ^i32, operand: i32) -> i32 {
|
||||
return win32.interlocked_or(a, operand);
|
||||
}
|
||||
proc spin_lock(a: ^i32, time_out: int) -> bool { // NOTE(bill) time_out = -1 as default
|
||||
var old_value = compare_exchange(a, 1, 0);
|
||||
var counter = 0;
|
||||
old_value := compare_exchange(a, 1, 0);
|
||||
counter := 0;
|
||||
for old_value != 0 && (time_out < 0 || counter < time_out) {
|
||||
counter++;
|
||||
yield_thread();
|
||||
@@ -50,7 +50,7 @@ proc spin_unlock(a: ^i32) {
|
||||
}
|
||||
proc try_acquire_lock(a: ^i32) -> bool {
|
||||
yield_thread();
|
||||
var old_value = compare_exchange(a, 1, 0);
|
||||
old_value := compare_exchange(a, 1, 0);
|
||||
mfence();
|
||||
return old_value == 0;
|
||||
}
|
||||
@@ -78,8 +78,8 @@ proc fetch_or(a: ^i64, operand: i64) -> i64 {
|
||||
return win32.interlocked_or64(a, operand);
|
||||
}
|
||||
proc spin_lock(a: ^i64, time_out: int) -> bool { // NOTE(bill) time_out = -1 as default
|
||||
var old_value = compare_exchange(a, 1, 0);
|
||||
var counter = 0;
|
||||
old_value := compare_exchange(a, 1, 0);
|
||||
counter := 0;
|
||||
for old_value != 0 && (time_out < 0 || counter < time_out) {
|
||||
counter++;
|
||||
yield_thread();
|
||||
@@ -94,7 +94,7 @@ proc spin_unlock(a: ^i64) {
|
||||
}
|
||||
proc try_acquire_lock(a: ^i64) -> bool {
|
||||
yield_thread();
|
||||
var old_value = compare_exchange(a, 1, 0);
|
||||
old_value := compare_exchange(a, 1, 0);
|
||||
mfence();
|
||||
return old_value == 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user