comparison src/syssignal.h @ 80572:32bd922619ad

(FORWARD_SIGNAL_TO_MAIN_THREAD): New define. (main_thread, SIGNAL_THREAD_CHECK): Conditionalize on FORWARD_SIGNAL_TO_MAIN_THREAD instead of HAVE_GTK_AND_PTHREAD.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Mon, 12 May 2008 08:30:26 +0000
parents fc2bcd2a8aad
children d2b202fafd8c
comparison
equal deleted inserted replaced
80571:2143d86d5d7c 80572:32bd922619ad
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */ 20 Boston, MA 02110-1301, USA. */
21 21
22 extern void init_signals P_ ((void)); 22 extern void init_signals P_ ((void));
23 23
24 #ifdef HAVE_GTK_AND_PTHREAD 24 #if defined (HAVE_GTK_AND_PTHREAD) || (defined (HAVE_CARBON) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1020)
25 #include <pthread.h> 25 #include <pthread.h>
26 /* If defined, asynchronous signals delivered to a non-main thread are
27 forwarded to the main thread. */
28 #define FORWARD_SIGNAL_TO_MAIN_THREAD
29 #endif
30
31 #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
26 extern pthread_t main_thread; 32 extern pthread_t main_thread;
27 #endif 33 #endif
28 34
29 #ifdef POSIX_SIGNALS 35 #ifdef POSIX_SIGNALS
30 36
205 #ifndef HAVE_STRSIGNAL 211 #ifndef HAVE_STRSIGNAL
206 /* strsignal is in sysdep.c */ 212 /* strsignal is in sysdep.c */
207 char *strsignal (); 213 char *strsignal ();
208 #endif 214 #endif
209 215
210 #ifdef HAVE_GTK_AND_PTHREAD 216 #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
211 #define SIGNAL_THREAD_CHECK(signo) \ 217 #define SIGNAL_THREAD_CHECK(signo) \
212 do { \ 218 do { \
213 if (!pthread_equal (pthread_self (), main_thread)) \ 219 if (!pthread_equal (pthread_self (), main_thread)) \
214 { \ 220 { \
215 /* POSIX says any thread can receive the signal. On GNU/Linux \ 221 /* POSIX says any thread can receive the signal. On GNU/Linux \
224 pthread_kill (main_thread, signo); \ 230 pthread_kill (main_thread, signo); \
225 return; \ 231 return; \
226 } \ 232 } \
227 } while (0) 233 } while (0)
228 234
229 #else /* not HAVE_GTK_AND_PTHREAD */ 235 #else /* not FORWARD_SIGNAL_TO_MAIN_THREAD */
230 #define SIGNAL_THREAD_CHECK(signo) 236 #define SIGNAL_THREAD_CHECK(signo)
231 #endif /* not HAVE_GTK_AND_PTHREAD */ 237 #endif /* not FORWARD_SIGNAL_TO_MAIN_THREAD */
232 /* arch-tag: 4580e86a-340d-4574-9e11-a742b6e1a152 238 /* arch-tag: 4580e86a-340d-4574-9e11-a742b6e1a152
233 (do not change this comment) */ 239 (do not change this comment) */