diff options
| author | gingerBill <bill@gingerbill.org> | 2021-06-08 15:57:00 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-06-08 15:57:00 +0100 |
| commit | 8ec2ca9dcd138f6f5e49cd3f6c6bb575a7e434e7 (patch) | |
| tree | a30e214bceb68e34bcb6191a3abd4d1c54762fd3 /core/sync/sync_linux.odin | |
| parent | f19bb0f4d45ba4352c4392807ca2b1efe5918ea7 (diff) | |
Remove `context.thread_id`
Diffstat (limited to 'core/sync/sync_linux.odin')
| -rw-r--r-- | core/sync/sync_linux.odin | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/sync/sync_linux.odin b/core/sync/sync_linux.odin index 74f2b1e87..aa3c7a068 100644 --- a/core/sync/sync_linux.odin +++ b/core/sync/sync_linux.odin @@ -2,6 +2,18 @@ package sync import "core:sys/unix" +foreign import libc "system:c" + +current_thread_id :: proc "contextless" () -> int { + foreign libc { + syscall :: proc(number: i32, #c_vararg args: ..any) -> i32 --- + } + + SYS_GETTID :: 186; + return int(syscall(SYS_GETTID)); +} + + // The Darwin docs say it best: // A semaphore is much like a lock, except that a finite number of threads can hold it simultaneously. // Semaphores can be thought of as being much like piles of tokens; multiple threads can take these tokens, |