From 4eb4ae6305720d226f6ccd1ee8d7b18b8436ced0 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 30 Mar 2022 17:42:44 +0100 Subject: Replace `sync` with `sync2` --- core/sync/sync_linux.odin | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 core/sync/sync_linux.odin (limited to 'core/sync/sync_linux.odin') diff --git a/core/sync/sync_linux.odin b/core/sync/sync_linux.odin deleted file mode 100644 index 340437c11..000000000 --- a/core/sync/sync_linux.odin +++ /dev/null @@ -1,36 +0,0 @@ -package sync - -import "core:sys/unix" - -current_thread_id :: proc "contextless" () -> int { - return unix.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, -// but when there are none left, a thread must wait until another thread returns one. -Semaphore :: struct #align 16 { - handle: unix.sem_t, -} - -semaphore_init :: proc(s: ^Semaphore, initial_count := 0) { - assert(unix.sem_init(&s.handle, 0, u32(initial_count)) == 0) -} - -semaphore_destroy :: proc(s: ^Semaphore) { - assert(unix.sem_destroy(&s.handle) == 0) - s.handle = {} -} - -semaphore_post :: proc(s: ^Semaphore, count := 1) { - // NOTE: SPEED: If there's one syscall to do this, we should use it instead of the loop. - for in 0..