1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-12-23 03:53:43 +01:00

Allow caller to block signals.

Greetings,

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

Thanks,
--
Paul Pluzhnikov

commit cf823ed0d4d2447aa91af0e3cb5fbb6a6cba5068
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date:   Mon Sep 21 11:37:38 2009 -0700

    New configure option to allow caller to block signals.
This commit is contained in:
Paul Pluzhnikov 2009-09-21 13:04:33 -07:00 committed by Arun Sharma
parent 84d4150668
commit 9aa0d6d680
2 changed files with 17 additions and 2 deletions

View file

@ -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"

View file

@ -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 */