changeset 72342:428ee64b35d5

* alloc.c (UNBLOCK_INPUT_ALLOC, BLOCK_INPUT_ALLOC): Use in_sighandler to check if mutex should be locked or not.
author Jan Djärv <jan.h.d@swipnet.se>
date Thu, 10 Aug 2006 06:09:30 +0000
parents 111c88ecd861
children 2ae29d562915
files src/alloc.c
diffstat 1 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/alloc.c	Thu Aug 10 06:07:15 2006 +0000
+++ b/src/alloc.c	Thu Aug 10 06:09:30 2006 +0000
@@ -130,17 +130,27 @@
 #define BLOCK_INPUT_ALLOC                       \
   do                                            \
     {                                           \
-      pthread_mutex_lock (&alloc_mutex);        \
-      if (pthread_self () == main_thread)       \
-        BLOCK_INPUT;                            \
+      if (!in_sighandler)                       \
+        {                                       \
+           pthread_mutex_lock (&alloc_mutex);   \
+           if (pthread_self () == main_thread)  \
+             BLOCK_INPUT;                       \
+           else                                 \
+             sigblock (sigmask (SIGIO));        \
+        }                                       \
     }                                           \
   while (0)
 #define UNBLOCK_INPUT_ALLOC                     \
   do                                            \
     {                                           \
-      if (pthread_self () == main_thread)       \
-        UNBLOCK_INPUT;                          \
-      pthread_mutex_unlock (&alloc_mutex);      \
+      if (!in_sighandler)                       \
+        {                                       \
+           pthread_mutex_unlock (&alloc_mutex); \
+           if (pthread_self () == main_thread)  \
+             UNBLOCK_INPUT;                     \
+           else                                 \
+             sigunblock (sigmask (SIGIO));      \
+        }                                       \
     }                                           \
   while (0)