diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2015-11-20 01:22:39 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2015-11-20 01:22:39 +0300 |
commit | c62a70c6c449361ee3dbb87ffe54d45ecab2a207 (patch) | |
tree | 086de2009125940d9921e0ab6e75f2c1e3f051b7 | |
parent | 02528757f439dfc5750e28fb3e5794303ccd21f9 (diff) | |
download | bdwgc-c62a70c6c449361ee3dbb87ffe54d45ecab2a207.tar.gz |
Remove 'sig' argument of GC_suspend_handler_inner
(Code refactoring)
* pthread_stop_world.c (GC_suspend_handler_inner): Rename "sig_arg"
argument to "dummy"; mark it as GC_ATTR_UNUSED.
* pthread_stop_world.c (GC_suspend_handler): Pass NULL instead of sig
to GC_suspend_handler_inner.
* pthread_stop_world.c (GC_suspend_handler): Move sig check from
GC_suspend_handler_inner.
-rw-r--r-- | pthread_stop_world.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 22393092..63c93c0f 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -200,7 +200,7 @@ STATIC sem_t GC_suspend_ack_sem; STATIC sem_t GC_restart_ack_sem; #endif -STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context); +STATIC void GC_suspend_handler_inner(ptr_t dummy, void *context); #ifndef NO_SA_SIGACTION STATIC void GC_suspend_handler(int sig, siginfo_t * info GC_ATTR_UNUSED, @@ -211,20 +211,30 @@ STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context); { int old_errno = errno; + if (sig != GC_sig_suspend) { +# if defined(GC_FREEBSD_THREADS) + /* Workaround "deferred signal handling" bug in FreeBSD 9.2. */ + if (0 == sig) return; +# endif + ABORT("Bad signal in suspend_handler"); + } + # if defined(IA64) || defined(HP_PA) || defined(M68K) - GC_with_callee_saves_pushed(GC_suspend_handler_inner, (ptr_t)(word)sig); + GC_with_callee_saves_pushed(GC_suspend_handler_inner, NULL); # else /* We believe that in all other cases the full context is already */ /* in the signal handler frame. */ -# ifdef NO_SA_SIGACTION - void *context = 0; -# endif - GC_suspend_handler_inner((ptr_t)(word)sig, context); + { +# ifdef NO_SA_SIGACTION + void *context = 0; +# endif + GC_suspend_handler_inner(NULL, context); + } # endif errno = old_errno; } -STATIC void GC_suspend_handler_inner(ptr_t sig_arg, +STATIC void GC_suspend_handler_inner(ptr_t dummy GC_ATTR_UNUSED, void * context GC_ATTR_UNUSED) { pthread_t self = pthread_self(); @@ -232,14 +242,6 @@ STATIC void GC_suspend_handler_inner(ptr_t sig_arg, IF_CANCEL(int cancel_state;) AO_t my_stop_count = AO_load(&GC_stop_count); - if ((signed_word)sig_arg != GC_sig_suspend) { -# if defined(GC_FREEBSD_THREADS) - /* Workaround "deferred signal handling" bug in FreeBSD 9.2. */ - if (0 == sig_arg) return; -# endif - ABORT("Bad signal in suspend_handler"); - } - DISABLE_CANCEL(cancel_state); /* pthread_setcancelstate is not defined to be async-signal-safe. */ /* But the glibc version appears to be in the absence of */ |