Mercurial > emacs
comparison src/alloc.c @ 75192:a62f8b0494a2
(BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Use pthread_equal,
block/unblock SIGIO.
| author | Jan Dj?rv <jan.h.d@swipnet.se> |
|---|---|
| date | Thu, 11 Jan 2007 19:21:53 +0000 |
| parents | b684c6771753 |
| children | 3d45362f1d38 |
comparison
equal
deleted
inserted
replaced
| 75191:98ad9ce30ba1 | 75192:a62f8b0494a2 |
|---|---|
| 125 to run Emacs code at once, and the code is not prepared for that. | 125 to run Emacs code at once, and the code is not prepared for that. |
| 126 To prevent that, we only call BLOCK/UNBLOCK from the main thread. */ | 126 To prevent that, we only call BLOCK/UNBLOCK from the main thread. */ |
| 127 | 127 |
| 128 static pthread_mutex_t alloc_mutex; | 128 static pthread_mutex_t alloc_mutex; |
| 129 | 129 |
| 130 #define BLOCK_INPUT_ALLOC \ | 130 #define BLOCK_INPUT_ALLOC \ |
| 131 do \ | 131 do \ |
| 132 { \ | 132 { \ |
| 133 if (pthread_self () == main_thread) \ | 133 if (pthread_equal (pthread_self (), main_thread)) \ |
| 134 BLOCK_INPUT; \ | 134 sigblock (sigmask (SIGIO)); \ |
| 135 pthread_mutex_lock (&alloc_mutex); \ | 135 pthread_mutex_lock (&alloc_mutex); \ |
| 136 } \ | 136 } \ |
| 137 while (0) | 137 while (0) |
| 138 #define UNBLOCK_INPUT_ALLOC \ | 138 #define UNBLOCK_INPUT_ALLOC \ |
| 139 do \ | 139 do \ |
| 140 { \ | 140 { \ |
| 141 pthread_mutex_unlock (&alloc_mutex); \ | 141 pthread_mutex_unlock (&alloc_mutex); \ |
| 142 if (pthread_self () == main_thread) \ | 142 if (pthread_equal (pthread_self (), main_thread)) \ |
| 143 UNBLOCK_INPUT; \ | 143 sigunblock (sigmask (SIGIO)); \ |
| 144 } \ | 144 } \ |
| 145 while (0) | 145 while (0) |
| 146 | 146 |
| 147 #else /* SYSTEM_MALLOC || not HAVE_GTK_AND_PTHREAD */ | 147 #else /* SYSTEM_MALLOC || not HAVE_GTK_AND_PTHREAD */ |
| 148 | 148 |
| 149 #define BLOCK_INPUT_ALLOC BLOCK_INPUT | 149 #define BLOCK_INPUT_ALLOC BLOCK_INPUT |
