replaced pthread_yield with ssched_yield, fixed semaphore post:q

This commit is contained in:
KTRosenberg
2020-01-02 16:25:48 -05:00
parent 93ead4bcb3
commit d017b5de9d
5 changed files with 14 additions and 6 deletions
+5 -3
View File
@@ -28,9 +28,11 @@ semaphore_destroy :: proc(s: ^Semaphore) {
}
semaphore_post :: proc(s: ^Semaphore, count := 1) {
assert(count == 1);
res := darwin.semaphore_signal(s.handle);
assert(res == 0);
// NOTE: SPEED: If there's one syscall to do this, we should use it instead of the loop.
for in 0..count-1 {
res := darwin.semaphore_signal(s.handle);
assert(res == 0);
}
}
semaphore_wait_for :: proc(s: ^Semaphore) {
+4 -1
View File
@@ -20,7 +20,10 @@ semaphore_destroy :: proc(s: ^Semaphore) {
}
semaphore_post :: proc(s: ^Semaphore, count := 1) {
assert(unix.sem_post(&s.handle) == 0);
// NOTE: SPEED: If there's one syscall to do this, we should use it instead of the loop.
for in 0..count-1 {
assert(unix.sem_post(&s.handle) == 0);
}
}
semaphore_wait_for :: proc(s: ^Semaphore) {