]> granicus.if.org Git - gc/commitdiff
2011-05-16 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Mon, 16 May 2011 07:06:33 +0000 (07:06 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:59 +0000 (21:06 +0400)
* pthread_stop_world.c (GC_suspend_handler_inner): Remove "dummy",
"sig" local variables; rename my_thread local variable to "self".

ChangeLog
pthread_stop_world.c

index 208daeff4915c2c7e443d41aa3645a9679aaaa8b..d96748e4100011a3fcb0cd8fb58ff16f3ffab176 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-16  Ivan Maidanski  <ivmai@mail.ru>
+
+       * 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  <ivmai@mail.ru>
 
        * tests/threadkey_test.c (LIMIT): Use smaller value (don't create
index feb70a3b8905f6939e81c94694e0349f7c864698..dfb0d8ad57fe621e8c3942fac4e401eed362a121 100644 (file)
@@ -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);
 }