ci: workaround linking on macos (missing sem_timedwait)

pull/12012/head
Delyan Angelov 2021-09-28 11:27:47 +03:00
parent 9e2607db57
commit 97eb0fc74f
1 changed files with 8 additions and 2 deletions

View File

@ -175,11 +175,17 @@ pub fn (mut sem Semaphore) try_wait() bool {
} }
pub fn (mut sem Semaphore) timed_wait(timeout time.Duration) bool { pub fn (mut sem Semaphore) timed_wait(timeout time.Duration) bool {
$if macos {
time.sleep(timeout)
return true
}
t_spec := timeout.timespec() t_spec := timeout.timespec()
for { for {
$if !macos {
if C.sem_timedwait(&sem.sem, &t_spec) == 0 { if C.sem_timedwait(&sem.sem, &t_spec) == 0 {
return true return true
} }
}
e := C.errno e := C.errno
match e { match e {
C.EINTR { C.EINTR {