diff options
author | deischen <deischen@FreeBSD.org> | 1999-12-04 22:55:59 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 1999-12-04 22:55:59 +0000 |
commit | 795e5a14ec1408b6597626c4d3b1e8d030992c2d (patch) | |
tree | 2a3f0eb4e20239d33ccff0ab0ca2a32ccdd128b0 /lib/libpthread/thread/thr_private.h | |
parent | d59911ee914d7ea0e3d9d8905a0875d17d832fb7 (diff) | |
download | FreeBSD-src-795e5a14ec1408b6597626c4d3b1e8d030992c2d.zip FreeBSD-src-795e5a14ec1408b6597626c4d3b1e8d030992c2d.tar.gz |
Change signal handling to conform to POSIX specified semantics.
Before this change, a signal was delivered to each thread that
didn't have the signal masked. Signals also improperly woke up
threads waiting on I/O. With this change, signals are now
handled in the following way:
o If a thread is waiting in a sigwait for the signal,
then the thread is woken up.
o If no threads are sigwait'ing on the signal and a
thread is in a sigsuspend waiting for the signal,
then the thread is woken up.
o In the case that no threads are waiting or suspended
on the signal, then the signal is delivered to the
first thread we find that has the signal unmasked.
o If no threads are waiting or suspended on the signal,
and no threads have the signal unmasked, then the signal
is added to the process wide pending signal set. The
signal will be delivered to the first thread that unmasks
the signal.
If there is an installed signal handler, it is only invoked
if the chosen thread was not in a sigwait.
In the case that multiple threads are waiting or suspended
on a signal, or multiple threads have the signal unmasked,
we wake up/deliver the signal to the first thread we find.
The above rules still apply.
Reported by: Scott Hess <scott@avantgo.com>
Reviewed by: jb, jasone
Diffstat (limited to 'lib/libpthread/thread/thr_private.h')
-rw-r--r-- | lib/libpthread/thread/thr_private.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libpthread/thread/thr_private.h b/lib/libpthread/thread/thr_private.h index 8bf8113..70c7487 100644 --- a/lib/libpthread/thread/thr_private.h +++ b/lib/libpthread/thread/thr_private.h @@ -858,7 +858,12 @@ SCLASS pthread_cond_t _gc_cond /* * Array of signal actions for this process. */ -struct sigaction _thread_sigact[NSIG]; +SCLASS struct sigaction _thread_sigact[NSIG]; + +/* + * Pending signals for this process. + */ +SCLASS sigset_t _process_sigpending; /* * Scheduling queues: @@ -944,7 +949,6 @@ int _thread_create(pthread_t *,const pthread_attr_t *,void *(*start_routine) int _thread_fd_lock(int, int, struct timespec *); int _thread_fd_lock_debug(int, int, struct timespec *,char *fname,int lineno); void _dispatch_signals(void); -void _thread_signal(pthread_t, int); int _mutex_cv_lock(pthread_mutex_t *); int _mutex_cv_unlock(pthread_mutex_t *); void _mutex_notify_priochange(pthread_t); |