]> git.corax.cc Git - toolbox/commit
include/sem: Implement sem_trywait() using sem_wait() with 0 timeout
authorMatthias Kruk <m@m10k.eu>
Mon, 26 Sep 2022 08:58:53 +0000 (17:58 +0900)
committerMatthias Kruk <m@m10k.eu>
Mon, 26 Sep 2022 08:58:53 +0000 (17:58 +0900)
commitaed0b2f64d44cf444a733ca96304a689f003ad30
treed5f3357f5024eb76cf29546ff3222102fb52031c
parentc7549ebd24cc1c587428173e100aaa0dd1edffcb
include/sem: Implement sem_trywait() using sem_wait() with 0 timeout

Because sem_trywait() does not unlock the waitlock if the counter is
greater than 1, the next caller will be left waiting until sem_post()
is executed.

This commit changes sem_trywait() to call sem_wait() with a timeout
of 0 seconds, since this issue does not affect sem_wait().
include/sem.sh