mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
Do signal deferral for pthread_kill() as it was done in the old days.
Submitted by: deischen
This commit is contained in:
parent
ed25321907
commit
adbd6ee028
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56310
@ -572,11 +572,6 @@ struct pthread {
|
||||
sigset_t sigmask;
|
||||
sigset_t sigpend;
|
||||
|
||||
#ifndef _NO_UNDISPATCH
|
||||
/* Non-zero if there are undispatched signals for this thread. */
|
||||
int undispatched_signals;
|
||||
#endif
|
||||
|
||||
/* Thread state: */
|
||||
enum pthread_state state;
|
||||
enum pthread_state oldstate;
|
||||
|
@ -39,7 +39,9 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <setjmp.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
@ -122,16 +124,12 @@ __asm__("fnsave %0": :"m"(*fdata));
|
||||
pthread_testcancel();
|
||||
}
|
||||
|
||||
#ifndef _NO_UNDISPATCH
|
||||
/*
|
||||
* Check for undispatched signals due to calls to
|
||||
* pthread_kill().
|
||||
*/
|
||||
if (_thread_run->undispatched_signals != 0) {
|
||||
_thread_run->undispatched_signals = 0;
|
||||
if (SIGNOTEMPTY(_thread_run->sigpend))
|
||||
_dispatch_signals();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (_sched_switch_hook != NULL) {
|
||||
/* Run the installed switch hook: */
|
||||
|
@ -628,27 +628,10 @@ _thread_sig_send(pthread_t pthread, int sig)
|
||||
!sigismember(&pthread->sigmask, sig)) {
|
||||
/* Perform any state changes due to signal arrival: */
|
||||
thread_sig_check_state(pthread, sig);
|
||||
|
||||
#ifndef _NO_UNDISPATCH
|
||||
if (_thread_run != pthread) {
|
||||
/*
|
||||
* Make a note to call the signal handler once
|
||||
* the signaled thread is running. This is
|
||||
* necessary in order to make sure that the
|
||||
* signal is delivered on the correct stack.
|
||||
*/
|
||||
pthread->undispatched_signals++;
|
||||
} else {
|
||||
#endif
|
||||
/* Call the installed signal handler. */
|
||||
_thread_sig_deliver(pthread, sig);
|
||||
#ifndef _NO_UNDISPATCH
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
/* Increment the pending signal count. */
|
||||
sigaddset(&pthread->sigpend,sig);
|
||||
}
|
||||
|
||||
/* Increment the pending signal count. */
|
||||
sigaddset(&pthread->sigpend,sig);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,9 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <setjmp.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
@ -122,16 +124,12 @@ __asm__("fnsave %0": :"m"(*fdata));
|
||||
pthread_testcancel();
|
||||
}
|
||||
|
||||
#ifndef _NO_UNDISPATCH
|
||||
/*
|
||||
* Check for undispatched signals due to calls to
|
||||
* pthread_kill().
|
||||
*/
|
||||
if (_thread_run->undispatched_signals != 0) {
|
||||
_thread_run->undispatched_signals = 0;
|
||||
if (SIGNOTEMPTY(_thread_run->sigpend))
|
||||
_dispatch_signals();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (_sched_switch_hook != NULL) {
|
||||
/* Run the installed switch hook: */
|
||||
|
@ -572,11 +572,6 @@ struct pthread {
|
||||
sigset_t sigmask;
|
||||
sigset_t sigpend;
|
||||
|
||||
#ifndef _NO_UNDISPATCH
|
||||
/* Non-zero if there are undispatched signals for this thread. */
|
||||
int undispatched_signals;
|
||||
#endif
|
||||
|
||||
/* Thread state: */
|
||||
enum pthread_state state;
|
||||
enum pthread_state oldstate;
|
||||
|
@ -628,27 +628,10 @@ _thread_sig_send(pthread_t pthread, int sig)
|
||||
!sigismember(&pthread->sigmask, sig)) {
|
||||
/* Perform any state changes due to signal arrival: */
|
||||
thread_sig_check_state(pthread, sig);
|
||||
|
||||
#ifndef _NO_UNDISPATCH
|
||||
if (_thread_run != pthread) {
|
||||
/*
|
||||
* Make a note to call the signal handler once
|
||||
* the signaled thread is running. This is
|
||||
* necessary in order to make sure that the
|
||||
* signal is delivered on the correct stack.
|
||||
*/
|
||||
pthread->undispatched_signals++;
|
||||
} else {
|
||||
#endif
|
||||
/* Call the installed signal handler. */
|
||||
_thread_sig_deliver(pthread, sig);
|
||||
#ifndef _NO_UNDISPATCH
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
/* Increment the pending signal count. */
|
||||
sigaddset(&pthread->sigpend,sig);
|
||||
}
|
||||
|
||||
/* Increment the pending signal count. */
|
||||
sigaddset(&pthread->sigpend,sig);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,9 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <setjmp.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
@ -122,16 +124,12 @@ __asm__("fnsave %0": :"m"(*fdata));
|
||||
pthread_testcancel();
|
||||
}
|
||||
|
||||
#ifndef _NO_UNDISPATCH
|
||||
/*
|
||||
* Check for undispatched signals due to calls to
|
||||
* pthread_kill().
|
||||
*/
|
||||
if (_thread_run->undispatched_signals != 0) {
|
||||
_thread_run->undispatched_signals = 0;
|
||||
if (SIGNOTEMPTY(_thread_run->sigpend))
|
||||
_dispatch_signals();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (_sched_switch_hook != NULL) {
|
||||
/* Run the installed switch hook: */
|
||||
|
@ -572,11 +572,6 @@ struct pthread {
|
||||
sigset_t sigmask;
|
||||
sigset_t sigpend;
|
||||
|
||||
#ifndef _NO_UNDISPATCH
|
||||
/* Non-zero if there are undispatched signals for this thread. */
|
||||
int undispatched_signals;
|
||||
#endif
|
||||
|
||||
/* Thread state: */
|
||||
enum pthread_state state;
|
||||
enum pthread_state oldstate;
|
||||
|
@ -628,27 +628,10 @@ _thread_sig_send(pthread_t pthread, int sig)
|
||||
!sigismember(&pthread->sigmask, sig)) {
|
||||
/* Perform any state changes due to signal arrival: */
|
||||
thread_sig_check_state(pthread, sig);
|
||||
|
||||
#ifndef _NO_UNDISPATCH
|
||||
if (_thread_run != pthread) {
|
||||
/*
|
||||
* Make a note to call the signal handler once
|
||||
* the signaled thread is running. This is
|
||||
* necessary in order to make sure that the
|
||||
* signal is delivered on the correct stack.
|
||||
*/
|
||||
pthread->undispatched_signals++;
|
||||
} else {
|
||||
#endif
|
||||
/* Call the installed signal handler. */
|
||||
_thread_sig_deliver(pthread, sig);
|
||||
#ifndef _NO_UNDISPATCH
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
/* Increment the pending signal count. */
|
||||
sigaddset(&pthread->sigpend,sig);
|
||||
}
|
||||
|
||||
/* Increment the pending signal count. */
|
||||
sigaddset(&pthread->sigpend,sig);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user