boehm-gc: revert all CACAO-specific modifications; this is now an exact copy of the...
[cacao.git] / src / mm / boehm-gc / include / gc_pthread_redirects.h
1 /* Our pthread support normally needs to intercept a number of thread   */
2 /* calls.  We arrange to do that here, if appropriate.                  */
3
4 #ifndef GC_PTHREAD_REDIRECTS_H
5
6 #define GC_PTHREAD_REDIRECTS_H
7
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.                          */
17
18 # include <pthread.h>
19 # include <signal.h>
20
21 # ifndef GC_DARWIN_THREADS
22 #   include <dlfcn.h>
23 # endif
24
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);
31 #endif
32   int GC_pthread_join(pthread_t thread, void **retval);
33   int GC_pthread_detach(pthread_t thread);
34
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
41 # undef pthread_join
42 # undef pthread_detach
43 #endif
44
45 # define pthread_create GC_pthread_create
46 # define pthread_join GC_pthread_join
47 # define pthread_detach GC_pthread_detach
48
49 #ifndef GC_DARWIN_THREADS
50 # ifdef pthread_sigmask
51 #  undef pthread_sigmask
52 # endif  /* pthread_sigmask */
53 # define pthread_sigmask GC_pthread_sigmask
54 # ifdef dlopen
55 #  undef dlopen
56 # endif
57 # define dlopen GC_dlopen
58 #endif
59
60 #endif /* GC_PTHREADS && !GC_USE_LD_WRAP */
61
62 #endif /* GC_PTHREAD_REDIRECTS_H */