Merge branch 'master' into separate-int-word-sizes

This commit is contained in:
gingerBill
2023-06-06 22:42:04 +01:00
147 changed files with 19917 additions and 10151 deletions
+7 -3
View File
@@ -3,7 +3,6 @@
package sync
import "core:c"
import "core:os"
import "core:time"
FUTEX_WAIT :: 1
@@ -14,11 +13,16 @@ FUTEX_PRIVATE_FLAG :: 128
FUTEX_WAIT_PRIVATE :: (FUTEX_WAIT | FUTEX_PRIVATE_FLAG)
FUTEX_WAKE_PRIVATE :: (FUTEX_WAKE | FUTEX_PRIVATE_FLAG)
ETIMEDOUT :: 60
foreign import libc "system:c"
foreign libc {
@(link_name="futex")
_unix_futex :: proc "c" (f: ^Futex, op: c.int, val: u32, timeout: rawptr) -> c.int ---
@(link_name="__errno") __errno :: proc() -> ^int ---
}
_futex_wait :: proc "contextless" (f: ^Futex, expected: u32) -> bool {
@@ -28,7 +32,7 @@ _futex_wait :: proc "contextless" (f: ^Futex, expected: u32) -> bool {
return true
}
if os.Errno(os.get_last_error()) == os.ETIMEDOUT {
if __errno()^ == ETIMEDOUT {
return false
}
@@ -54,7 +58,7 @@ _futex_wait_with_timeout :: proc "contextless" (f: ^Futex, expected: u32, durati
return true
}
if os.Errno(os.get_last_error()) == os.ETIMEDOUT {
if __errno()^ == ETIMEDOUT {
return false
}
+8 -2
View File
@@ -2,8 +2,14 @@
//+private
package sync
import "core:os"
foreign import libc "system:c"
@(default_calling_convention="c")
foreign libc {
@(link_name="getthrid", private="file")
_unix_getthrid :: proc() -> int ---
}
_current_thread_id :: proc "contextless" () -> int {
return os.current_thread_id()
return _unix_getthrid()
}