mirror of
git://git.musl-libc.org/musl
synced 2025-01-31 11:01:34 +00:00
make sem_wait and sem_timedwait interruptible by signals
this reverts commitc0ed5a201b
, which was based on a mistaken reading of POSIX due to inconsistency between the description (which requires return upon interruption by a signal) and the errors list (which wrongly lists EINTR as "may fail"). since the previously-introduced behavior was a workaround for an old kernel bug to ensure safety of correct programs that were not hardened against the bug, an effort has been made to preserve it for programs which do not use interrupting signal handlers. the stage for this was set in commita63c0104e4
, which makes the futex __timedwait backend suppress EINTR if it's seen when no interrupting signal handlers have been installed. based loosely on a patch submitted by Orivej Desh, but with unnecessary additional changes removed.
This commit is contained in:
parent
1ec71c531e
commit
21a172dd36
@ -22,7 +22,7 @@ int sem_timedwait(sem_t *restrict sem, const struct timespec *restrict at)
|
||||
pthread_cleanup_push(cleanup, (void *)(sem->__val+1));
|
||||
r = __timedwait_cp(sem->__val, -1, CLOCK_REALTIME, at, sem->__val[2]);
|
||||
pthread_cleanup_pop(1);
|
||||
if (r && r != EINTR) {
|
||||
if (r) {
|
||||
errno = r;
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user