OSDN Git Service

2005-09-08 Andrew Haley <aph@redhat.com>
[pf3gnuchains/gcc-fork.git] / boehm-gc / pthread_stop_world.c
index 832c49c..b5e7fae 100644 (file)
@@ -101,8 +101,28 @@ word GC_stop_count;        /* Incremented at the beginning of GC_stop_world. */
 
 sem_t GC_suspend_ack_sem;
 
+void GC_suspend_handler_inner(ptr_t sig_arg);
+
+#if defined(IA64) || defined(HP_PA)
+extern void GC_with_callee_saves_pushed();
+
 void GC_suspend_handler(int sig)
 {
+  GC_with_callee_saves_pushed(GC_suspend_handler_inner, (ptr_t)(word)sig);
+}
+
+#else
+/* We believe that in all other cases the full context is already      */
+/* in the signal handler frame.                                                */
+void GC_suspend_handler(int sig)
+{
+  GC_suspend_handler_inner((ptr_t)(word)sig);
+}
+#endif
+
+void GC_suspend_handler_inner(ptr_t sig_arg)
+{
+    int sig = (int)(word)sig_arg;
     int dummy;
     pthread_t my_thread = pthread_self();
     GC_thread me;
@@ -369,9 +389,11 @@ void GC_stop_world()
          }
       }
     for (i = 0; i < n_live_threads; i++) {
-         if (0 != (code = sem_wait(&GC_suspend_ack_sem))) {
+         while (0 != (code = sem_wait(&GC_suspend_ack_sem))) {
+           if (errno != EINTR) {
              GC_err_printf1("Sem_wait returned %ld\n", (unsigned long)code);
              ABORT("sem_wait for handler failed");
+           }
          }
     }
 #   ifdef PARALLEL_MARK