changeset: 69129:ebc03d7e7110 user: Victor Stinner date: Mon Apr 04 11:05:21 2011 +0200 files: Modules/faulthandler.c description: Issue #11753: faulthandler thread uses pthread_sigmask() The thread must not receive any signal. If the thread receives a signal, sem_timedwait() is interrupted and returns EINTR, but in this case, PyThread_acquire_lock_timed() retries sem_timedwait() and the main thread is not aware of the signal. The problem is that some tests expect that the main thread receives the signal, not faulthandler handler, which should be invisible. On Linux, the signal looks to be received by the main thread, whereas on FreeBSD, it can be any thread. diff -r 838e3b07a7f8 -r ebc03d7e7110 Modules/faulthandler.c --- a/Modules/faulthandler.c Mon Apr 04 02:14:25 2011 +0200 +++ b/Modules/faulthandler.c Mon Apr 04 11:05:21 2011 +0200 @@ -399,6 +399,17 @@ const char* errmsg; PyThreadState *current; int ok; +#ifdef HAVE_PTHREAD_H + sigset_t set; + + /* we don't want to receive any signal */ + sigfillset(&set); +#if defined(HAVE_PTHREAD_SIGMASK) && !defined(HAVE_BROKEN_PTHREAD_SIGMASK) + pthread_sigmask(SIG_SETMASK, &set, NULL); +#else + sigprocmask(SIG_SETMASK, &set, NULL); +#endif +#endif do { st = PyThread_acquire_lock_timed(thread.cancel_event,

AltStyle によって変換されたページ (->オリジナル) /