diff options
author | jasone <jasone@FreeBSD.org> | 2000-08-01 21:19:09 +0000 |
---|---|---|
committer | jasone <jasone@FreeBSD.org> | 2000-08-01 21:19:09 +0000 |
commit | a8691b84207f1350a08bf646a6b0ef37b86d24c0 (patch) | |
tree | 293b7aa4daa81b04615ec6d65bceb18c967e3c56 /lib/libkse | |
parent | d0631cde55a2d25fa1322a6b9aa2b01729dc19b4 (diff) | |
download | FreeBSD-src-a8691b84207f1350a08bf646a6b0ef37b86d24c0.zip FreeBSD-src-a8691b84207f1350a08bf646a6b0ef37b86d24c0.tar.gz |
Make sem_post() safe to call from within a signal handler, as required by
POSIX/SUSv2.
Diffstat (limited to 'lib/libkse')
-rw-r--r-- | lib/libkse/thread/thr_sem.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libkse/thread/thr_sem.c b/lib/libkse/thread/thr_sem.c index 10dec5e..5a4757c 100644 --- a/lib/libkse/thread/thr_sem.c +++ b/lib/libkse/thread/thr_sem.c @@ -206,6 +206,12 @@ sem_post(sem_t *sem) _SEM_CHECK_VALIDITY(sem); + /* + * sem_post() is required to be safe to call from within signal + * handlers. Thus, we must defer signals. + */ + _thread_kern_sig_defer(); + pthread_mutex_lock(&(*sem)->lock); (*sem)->count++; @@ -221,6 +227,7 @@ sem_post(sem_t *sem) pthread_mutex_unlock(&(*sem)->lock); + _thread_kern_sig_defer(); retval = 0; RETURN: return retval; |