| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
#ifndef ECL_STACK_RESIZE_H |
| 15 |
#define ECL_STACK_RESIZE_H |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#if defined(ECL_THREADS) && defined(ECL_USE_MPROTECT) |
| 23 |
# ifdef HAVE_SIGPROCMASK |
| 24 |
# include <signal.h> |
| 25 |
# define ECL_STACK_RESIZE_DISABLE_INTERRUPTS(the_env) \ |
| 26 |
sigset_t __sigset_new, __sigset_previous; \ |
| 27 |
sigfillset(&__sigset_new); \ |
| 28 |
sigdelset(&__sigset_new, SIGSEGV); \ |
| 29 |
sigdelset(&__sigset_new, SIGBUS); \ |
| 30 |
pthread_sigmask(SIG_BLOCK, &__sigset_new, &__sigset_previous) |
| 31 |
# define ECL_STACK_RESIZE_ENABLE_INTERRUPTS(the_env) \ |
| 32 |
pthread_sigmask(SIG_SETMASK, &__sigset_previous, NULL) |
| 33 |
# else |
| 34 |
# error "Can't protect stack resizing from interrupts without sigprocmask. Either build ECL without mprotect() or live with possible race conditions." |
| 35 |
# endif |
| 36 |
#else |
| 37 |
# define ECL_STACK_RESIZE_DISABLE_INTERRUPTS(the_env) ecl_disable_interrupts_env(the_env); |
| 38 |
# define ECL_STACK_RESIZE_ENABLE_INTERRUPTS(the_env) ecl_enable_interrupts_env(env); |
| 39 |
# endif |
| 40 |
|
| 41 |
#endif |