# HG changeset patch
# User Jan Djärv <jan.h.d@swipnet.se>
# Date 1155190170 0
# Node ID 428ee64b35d522374c3615f1c452b2be1fa197d9
# Parent  111c88ecd8617dfdbc4889b0343ea312daab6a52
 * alloc.c (UNBLOCK_INPUT_ALLOC, BLOCK_INPUT_ALLOC): Use in_sighandler
 to check if mutex should be locked or not.

diff -r 111c88ecd861 -r 428ee64b35d5 src/alloc.c
--- 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)