1 /* Our pthread support normally needs to intercept a number of thread */
2 /* calls. We arrange to do that here, if appropriate. */
4 #ifndef GC_PTHREAD_REDIRECTS_H
6 #define GC_PTHREAD_REDIRECTS_H
8 #if !defined(GC_USE_LD_WRAP) && defined(GC_PTHREADS)
9 /* We need to intercept calls to many of the threads primitives, so */
10 /* that we can locate thread stacks and stop the world. */
11 /* Note also that the collector cannot always see thread specific data. */
12 /* Thread specific data should generally consist of pointers to */
13 /* uncollectable objects (allocated with GC_malloc_uncollectable, */
14 /* not the system malloc), which are deallocated using the destructor */
15 /* facility in thr_keycreate. Alternatively, keep a redundant pointer */
16 /* to thread specific data on the thread stack. */
21 # ifndef GC_DARWIN_THREADS
25 int GC_pthread_create(pthread_t *new_thread,
26 const pthread_attr_t *attr,
27 void *(*start_routine)(void *), void *arg);
28 #ifndef GC_DARWIN_THREADS
29 int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
30 void *GC_dlopen(const char *path, int mode);
32 int GC_pthread_join(pthread_t thread, void **retval);
33 int GC_pthread_detach(pthread_t thread);
35 #if defined(GC_OSF1_THREADS) \
36 && defined(_PTHREAD_USE_MANGLED_NAMES_) && !defined(_PTHREAD_USE_PTDNAM_)
37 /* Unless the compiler supports #pragma extern_prefix, the Tru64 UNIX
38 <pthread.h> redefines some POSIX thread functions to use mangled names.
39 If so, undef them before redefining. */
40 # undef pthread_create
42 # undef pthread_detach
45 # define pthread_create GC_pthread_create
46 # define pthread_join GC_pthread_join
47 # define pthread_detach GC_pthread_detach
49 #ifndef GC_DARWIN_THREADS
50 # ifdef pthread_sigmask
51 # undef pthread_sigmask
52 # endif /* pthread_sigmask */
53 # define pthread_sigmask GC_pthread_sigmask
57 # define dlopen GC_dlopen
60 #endif /* GC_PTHREADS && !GC_USE_LD_WRAP */
62 #endif /* GC_PTHREAD_REDIRECTS_H */