20 |
|
|
21 |
extern void init_signals P_ ((void)); |
extern void init_signals P_ ((void)); |
22 |
|
|
23 |
|
#ifdef HAVE_GTK_AND_PTHREAD |
24 |
|
#include <pthread.h> |
25 |
|
extern pthread_t main_thread; |
26 |
|
#endif |
27 |
|
|
28 |
#ifdef POSIX_SIGNALS |
#ifdef POSIX_SIGNALS |
29 |
|
|
30 |
/* Don't #include <signal.h>. That header should always be #included |
/* Don't #include <signal.h>. That header should always be #included |
203 |
char *strsignal (); |
char *strsignal (); |
204 |
#endif |
#endif |
205 |
|
|
206 |
|
#ifdef HAVE_GTK_AND_PTHREAD |
207 |
|
#define SIGNAL_THREAD_CHECK(signo) \ |
208 |
|
do { \ |
209 |
|
if (pthread_self () != main_thread) \ |
210 |
|
{ \ |
211 |
|
/* POSIX says any thread can receive the signal. On GNU/Linux \ |
212 |
|
that is not true, but for other systems (FreeBSD at least) \ |
213 |
|
it is. So direct the signal to the correct thread and block \ |
214 |
|
it from this thread. */ \ |
215 |
|
sigset_t new_mask; \ |
216 |
|
\ |
217 |
|
sigemptyset (&new_mask); \ |
218 |
|
sigaddset (&new_mask, signo); \ |
219 |
|
pthread_sigmask (SIG_BLOCK, &new_mask, 0); \ |
220 |
|
pthread_kill (main_thread, signo); \ |
221 |
|
return; \ |
222 |
|
} \ |
223 |
|
} while (0) |
224 |
|
|
225 |
|
#else /* not HAVE_GTK_AND_PTHREAD */ |
226 |
|
#define SIGNAL_THREAD_CHECK(signo) |
227 |
|
#endif /* not HAVE_GTK_AND_PTHREAD */ |
228 |
/* arch-tag: 4580e86a-340d-4574-9e11-a742b6e1a152 |
/* arch-tag: 4580e86a-340d-4574-9e11-a742b6e1a152 |
229 |
(do not change this comment) */ |
(do not change this comment) */ |