libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libunwind-devel] [patch 2/2] Allow caller to block signals.


From: Paul Pluzhnikov
Subject: [Libunwind-devel] [patch 2/2] Allow caller to block signals.
Date: Mon, 21 Sep 2009 13:04:33 -0700 (PDT)

Greetings,

Here is the second part, actually implementing the configure option.

Thanks,
--
Paul Pluzhnikov


commit cf823ed0d4d2447aa91af0e3cb5fbb6a6cba5068
Author: Paul Pluzhnikov <address@hidden>
Date:   Mon Sep 21 11:37:38 2009 -0700

    New configure option to allow caller to block signals.

diff --git a/configure.in b/configure.in
index 1271a56..6e55563 100644
--- a/configure.in
+++ b/configure.in
@@ -139,6 +139,14 @@ if test x$enable_debug_frame = xyes; then
   AC_DEFINE([CONFIG_DEBUG_FRAME], [], [Enable Debug Frame])
 fi
 
+AC_ARG_ENABLE(block_signals,
+[  --enable-block-signals Block signals before performing mutex operations],
+[enable_block_signals=$enableval], [enable_block_signals=yes])
+if test x$enable_block_signals = xyes; then
+  AC_DEFINE([CONFIG_BLOCK_SIGNALS], [], [Block signals before mutex 
operations])
+fi
+
+
 LIBUNWIND___THREAD
 
 save_LDFLAGS="$LDFLAGS"
diff --git a/include/libunwind_i.h b/include/libunwind_i.h
index 333ee37..a818601 100644
--- a/include/libunwind_i.h
+++ b/include/libunwind_i.h
@@ -178,18 +178,25 @@ typedef sigset_t intrmask_t;
 
 extern intrmask_t unwi_full_mask;
 
+#if defined(CONFIG_BLOCK_SIGNALS)
+# define SIGPROCMASK(how, old_mask, new_mask) \
+  sigprocmask((how), (old_mask), (new_mask))
+#else
+# define SIGPROCMASK(how, old_mask, new_mask) /**/
+#endif
+
 #define define_lock(name) \
   pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER
 #define lock_init(l)           mutex_init (l)
 #define lock_acquire(l,m)                              \
 do {                                                   \
-  sigprocmask (SIG_SETMASK, &unwi_full_mask, &(m));    \
+  SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &(m));    \
   mutex_lock (l);                                      \
 } while (0)
 #define lock_release(l,m)                      \
 do {                                           \
   mutex_unlock (l);                            \
-  sigprocmask (SIG_SETMASK, &(m), NULL);       \
+  SIGPROCMASK (SIG_SETMASK, &(m), NULL);       \
 } while (0)
 
 #define SOS_MEMORY_SIZE 16384  /* see src/mi/mempool.c */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]