From 31fc0f694f439b23c47431fc7a976691e67a3331 Mon Sep 17 00:00:00 2001 From: ivmai Date: Mon, 16 May 2011 07:06:33 +0000 Subject: [PATCH] 2011-05-16 Ivan Maidanski * pthread_stop_world.c (GC_suspend_handler_inner): Remove "dummy", "sig" local variables; rename my_thread local variable to "self". --- ChangeLog | 5 +++++ pthread_stop_world.c | 18 ++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 208daef..d96748e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-05-16 Ivan Maidanski + + * pthread_stop_world.c (GC_suspend_handler_inner): Remove "dummy", + "sig" local variables; rename my_thread local variable to "self". + 2011-05-13 Ivan Maidanski * tests/threadkey_test.c (LIMIT): Use smaller value (don't create diff --git a/pthread_stop_world.c b/pthread_stop_world.c index feb70a3..dfb0d8a 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -178,15 +178,13 @@ STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context); /*ARGSUSED*/ STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context) { - int sig = (int)(word)sig_arg; - int dummy; - pthread_t my_thread = pthread_self(); + pthread_t self = pthread_self(); GC_thread me; IF_CANCEL(int cancel_state;) - AO_t my_stop_count = AO_load(&GC_stop_count); - if (sig != SIG_SUSPEND) ABORT("Bad signal in suspend_handler"); + if ((signed_word)sig_arg != SIG_SUSPEND) + ABORT("Bad signal in suspend_handler"); DISABLE_CANCEL(cancel_state); /* pthread_setcancelstate is not defined to be async-signal-safe. */ @@ -198,10 +196,10 @@ STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context) /* cancellation point is inherently a problem, unless there is */ /* some way to disable cancellation in the handler. */ # ifdef DEBUG_THREADS - GC_log_printf("Suspending 0x%x\n", (unsigned)my_thread); + GC_log_printf("Suspending 0x%x\n", (unsigned)self); # endif - me = GC_lookup_thread(my_thread); + me = GC_lookup_thread(self); /* The lookup here is safe, since I'm doing this on behalf */ /* of a thread which holds the allocation lock in order */ /* to stop the world. Thus concurrent modification of the */ @@ -209,7 +207,7 @@ STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context) if (me -> stop_info.last_stop_count == my_stop_count) { /* Duplicate signal. OK if we are retrying. */ if (!GC_retry_signals) { - WARN("Duplicate suspend signal in thread %p\n", pthread_self()); + WARN("Duplicate suspend signal in thread %p\n", self); } RESTORE_CANCEL(cancel_state); return; @@ -217,7 +215,7 @@ STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context) # ifdef SPARC me -> stop_info.stack_ptr = GC_save_regs_in_stack(); # else - me -> stop_info.stack_ptr = (ptr_t)(&dummy); + me -> stop_info.stack_ptr = (ptr_t)(&me); # endif # ifdef IA64 me -> backing_store_ptr = GC_save_regs_in_stack(); @@ -252,7 +250,7 @@ STATIC void GC_suspend_handler_inner(ptr_t sig_arg, void *context) /* unlikely to be efficient. */ # ifdef DEBUG_THREADS - GC_log_printf("Continuing 0x%x\n", (unsigned)my_thread); + GC_log_printf("Continuing 0x%x\n", (unsigned)self); # endif RESTORE_CANCEL(cancel_state); } -- 2.7.4