CMakeLists.txt now has Linux support
[libs.git] / deps / gc / include / gc_pthread_redirects.h
blobb567f63e14f0efd1b6a140162df4e694369ce976
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. */
18 # include <pthread.h>
19 # include <signal.h>
21 int GC_pthread_create(pthread_t *new_thread,
22 const pthread_attr_t *attr,
23 void *(*start_routine)(void *), void *arg);
24 #ifndef GC_DARWIN_THREADS
25 int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
26 #endif
27 int GC_pthread_join(pthread_t thread, void **retval);
28 int GC_pthread_detach(pthread_t thread);
30 #if defined(GC_OSF1_THREADS) \
31 && defined(_PTHREAD_USE_MANGLED_NAMES_) && !defined(_PTHREAD_USE_PTDNAM_)
32 /* Unless the compiler supports #pragma extern_prefix, the Tru64 UNIX
33 <pthread.h> redefines some POSIX thread functions to use mangled names.
34 If so, undef them before redefining. */
35 # undef pthread_create
36 # undef pthread_join
37 # undef pthread_detach
38 #endif
40 # define pthread_create GC_pthread_create
41 # define pthread_join GC_pthread_join
42 # define pthread_detach GC_pthread_detach
44 #ifndef GC_DARWIN_THREADS
45 # ifdef pthread_sigmask
46 # undef pthread_sigmask
47 # endif /* pthread_sigmask */
48 # define pthread_sigmask GC_pthread_sigmask
49 # define dlopen GC_dlopen
50 #endif
52 #endif /* GC_xxxxx_THREADS */
54 #endif /* GC_PTHREAD_REDIRECTS_H */