Skip to content
Snippets Groups Projects
Commit 8f3581d8 authored by deuce's avatar deuce
Browse files

Of course, sem_trywait_block RETURNS the error number, it does not

necessarily set the global errno (duh)
parent 0b168653
No related branches found
No related tags found
No related merge requests found
...@@ -54,7 +54,8 @@ sem_trywait_block(sem_t *sem, unsigned long timeout) ...@@ -54,7 +54,8 @@ sem_trywait_block(sem_t *sem, unsigned long timeout)
abstime.tv_sec=currtime.tv_sec + (currtime.tv_usec/1000 + timeout)/1000; abstime.tv_sec=currtime.tv_sec + (currtime.tv_usec/1000 + timeout)/1000;
abstime.tv_nsec=(currtime.tv_usec*1000 + timeout*1000000)%1000000000; abstime.tv_nsec=(currtime.tv_usec*1000 + timeout*1000000)%1000000000;
if((retval=sem_timedwait(sem, &abstime)) && errno==ETIMEDOUT) retval=sem_timedwait(sem, &abstime);
if(retval==ETIMEDOUT)
errno=EAGAIN; errno=EAGAIN;
return retval; return retval;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment