/[dotgnu-pnet]/pnet/libgc/pthread_stop_world.c
ViewVC logotype

Diff of /pnet/libgc/pthread_stop_world.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by tum, Wed May 26 22:47:10 2004 UTC revision 1.2 by ktreichel, Sat Jul 23 12:52:58 2005 UTC
# Line 1  Line 1 
1  #include "private/pthread_support.h"  #include "private/pthread_support.h"
2    
3  #if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \  #if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
4       && !defined(GC_IRIX_THREADS) && !defined(GC_WIN32_THREADS) \       && !defined(GC_WIN32_THREADS) && !defined(GC_DARWIN_THREADS)
      && !defined(GC_DARWIN_THREADS) && !defined(GC_AIX_THREADS)  
5    
6  #include <signal.h>  #include <signal.h>
7  #include <semaphore.h>  #include <semaphore.h>
# Line 101  word GC_stop_count;    /* Incremented at th Line 100  word GC_stop_count;    /* Incremented at th
100    
101  sem_t GC_suspend_ack_sem;  sem_t GC_suspend_ack_sem;
102    
103    void GC_suspend_handler_inner(ptr_t sig_arg);
104    
105    #if defined(IA64) || defined(HP_PA)
106    extern void GC_with_callee_saves_pushed();
107    
108    void GC_suspend_handler(int sig)
109    {
110      int old_errno = errno;
111      GC_with_callee_saves_pushed(GC_suspend_handler_inner, (ptr_t)(word)sig);
112      errno = old_errno;
113    }
114    
115    #else
116    /* We believe that in all other cases the full context is already       */
117    /* in the signal handler frame.                                         */
118  void GC_suspend_handler(int sig)  void GC_suspend_handler(int sig)
119  {  {
120      int old_errno = errno;
121      GC_suspend_handler_inner((ptr_t)(word)sig);
122      errno = old_errno;
123    }
124    #endif
125    
126    void GC_suspend_handler_inner(ptr_t sig_arg)
127    {
128        int sig = (int)(word)sig_arg;
129      int dummy;      int dummy;
130      pthread_t my_thread = pthread_self();      pthread_t my_thread = pthread_self();
131      GC_thread me;      GC_thread me;
# Line 369  void GC_stop_world() Line 392  void GC_stop_world()
392            }            }
393        }        }
394      for (i = 0; i < n_live_threads; i++) {      for (i = 0; i < n_live_threads; i++) {
395            if (0 != (code = sem_wait(&GC_suspend_ack_sem))) {            while (0 != (code = sem_wait(&GC_suspend_ack_sem))) {
396                GC_err_printf1("Sem_wait returned %ld\n", (unsigned long)code);                if (errno != EINTR) {
397                ABORT("sem_wait for handler failed");                   GC_err_printf1("Sem_wait returned %ld\n", (unsigned long)code);
398                     ABORT("sem_wait for handler failed");
399                  }
400            }            }
401      }      }
402  #   ifdef PARALLEL_MARK  #   ifdef PARALLEL_MARK

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26