Embed:
(wiki syntax)
Show/hide line numbers
gc_pthread_redirects.h
00001 /* Our pthread support normally needs to intercept a number of thread */ 00002 /* calls. We arrange to do that here, if appropriate. */ 00003 00004 #ifndef GC_PTHREAD_REDIRECTS_H 00005 00006 #define GC_PTHREAD_REDIRECTS_H 00007 00008 #if defined(GC_SOLARIS_THREADS) 00009 /* We need to intercept calls to many of the threads primitives, so */ 00010 /* that we can locate thread stacks and stop the world. */ 00011 /* Note also that the collector cannot see thread specific data. */ 00012 /* Thread specific data should generally consist of pointers to */ 00013 /* uncollectable objects (allocated with GC_malloc_uncollectable, */ 00014 /* not the system malloc), which are deallocated using the destructor */ 00015 /* facility in thr_keycreate. Alternatively, keep a redundant pointer */ 00016 /* to thread specific data on the thread stack. */ 00017 # include <thread.h> 00018 int GC_thr_create(void *stack_base, size_t stack_size, 00019 void *(*start_routine)(void *), void *arg, long flags, 00020 thread_t *new_thread); 00021 int GC_thr_join(thread_t wait_for, thread_t *departed, void **status); 00022 int GC_thr_suspend(thread_t target_thread); 00023 int GC_thr_continue(thread_t target_thread); 00024 void * GC_dlopen(const char *path, int mode); 00025 # define thr_create GC_thr_create 00026 # define thr_join GC_thr_join 00027 # define thr_suspend GC_thr_suspend 00028 # define thr_continue GC_thr_continue 00029 #endif /* GC_SOLARIS_THREADS */ 00030 00031 #if defined(GC_SOLARIS_PTHREADS) 00032 # include <pthread.h> 00033 # include <signal.h> 00034 extern int GC_pthread_create(pthread_t *new_thread, 00035 const pthread_attr_t *attr, 00036 void * (*thread_execp)(void *), void *arg); 00037 extern int GC_pthread_join(pthread_t wait_for, void **status); 00038 # define pthread_join GC_pthread_join 00039 # define pthread_create GC_pthread_create 00040 #endif 00041 00042 #if defined(GC_SOLARIS_PTHREADS) || defined(GC_SOLARIS_THREADS) 00043 # define dlopen GC_dlopen 00044 #endif /* SOLARIS_THREADS || SOLARIS_PTHREADS */ 00045 00046 00047 #if !defined(GC_USE_LD_WRAP) && defined(GC_PTHREADS) && !defined(GC_SOLARIS_PTHREADS) 00048 /* We treat these similarly. */ 00049 # include <pthread.h> 00050 # include <signal.h> 00051 00052 int GC_pthread_create(pthread_t *new_thread, 00053 const pthread_attr_t *attr, 00054 void *(*start_routine)(void *), void *arg); 00055 #ifndef GC_DARWIN_THREADS 00056 int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset); 00057 #endif 00058 int GC_pthread_join(pthread_t thread, void **retval); 00059 int GC_pthread_detach(pthread_t thread); 00060 00061 #if defined(GC_OSF1_THREADS) \ 00062 && defined(_PTHREAD_USE_MANGLED_NAMES_) && !defined(_PTHREAD_USE_PTDNAM_) 00063 /* Unless the compiler supports #pragma extern_prefix, the Tru64 UNIX 00064 <pthread.h> redefines some POSIX thread functions to use mangled names. 00065 If so, undef them before redefining. */ 00066 # undef pthread_create 00067 # undef pthread_join 00068 # undef pthread_detach 00069 #endif 00070 00071 # define pthread_create GC_pthread_create 00072 # define pthread_join GC_pthread_join 00073 # define pthread_detach GC_pthread_detach 00074 00075 #ifndef GC_DARWIN_THREADS 00076 # define pthread_sigmask GC_pthread_sigmask 00077 # define dlopen GC_dlopen 00078 #endif 00079 00080 #endif /* GC_xxxxx_THREADS */ 00081 00082 #endif /* GC_PTHREAD_REDIRECTS_H */
Generated on Tue Jul 12 2022 19:59:54 by
1.7.2