2 * Copyright (c) 1994 by Xerox Corporation. All rights reserved.
3 * Copyright (c) 1996 by Silicon Graphics. All rights reserved.
4 * Copyright (c) 1998 by Fergus Henderson. All rights reserved.
5 * Copyright (c) 2000-2009 by Hewlett-Packard Development Company.
8 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
9 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
11 * Permission is hereby granted to use or copy this program
12 * for any purpose, provided the above notices are retained on all copies.
13 * Permission to modify the code and to distribute modified code is granted,
14 * provided the above notices are retained, and a notice that the code was
15 * modified is included with the above copyright notice.
18 /* Our pthread support normally needs to intercept a number of thread */
19 /* calls. We arrange to do that here, if appropriate. */
21 /* Included from gc.h only. Included only if GC_PTHREADS. */
23 /* We need to intercept calls to many of the threads primitives, so */
24 /* that we can locate thread stacks and stop the world. */
25 /* Note also that the collector cannot always see thread specific data. */
26 /* Thread specific data should generally consist of pointers to */
27 /* uncollectable objects (allocated with GC_malloc_uncollectable, */
28 /* not the system malloc), which are deallocated using the destructor */
29 /* facility in thr_keycreate. Alternatively, keep a redundant pointer */
30 /* to thread specific data on the thread stack. */
34 #ifndef GC_DARWIN_THREADS
38 # ifndef GC_OPENBSD_THREADS
39 GC_API int GC_pthread_sigmask(int /* how */, const sigset_t *,
40 sigset_t * /* oset */);
42 GC_API void *GC_dlopen(const char * /* path */, int /* mode */);
45 GC_API int GC_pthread_create(pthread_t *, const pthread_attr_t *,
46 void *(*)(void *), void * /* arg */);
47 GC_API int GC_pthread_join(pthread_t, void ** /* retval */);
48 GC_API int GC_pthread_detach(pthread_t);
50 #if !defined(GC_NO_THREAD_REDIRECTS) && !defined(GC_USE_LD_WRAP)
51 /* Unless the compiler supports #pragma extern_prefix, the Tru64 */
52 /* UNIX <pthread.h> redefines some POSIX thread functions to use */
53 /* mangled names. Anyway, it's safe to undef them before */
55 # undef pthread_create
57 # undef pthread_detach
59 # define pthread_create GC_pthread_create
60 # define pthread_join GC_pthread_join
61 # define pthread_detach GC_pthread_detach
63 # ifndef GC_DARWIN_THREADS
64 # ifndef GC_OPENBSD_THREADS
65 # undef pthread_sigmask
66 # define pthread_sigmask GC_pthread_sigmask
69 # define dlopen GC_dlopen
71 #endif /* !GC_NO_THREAD_REDIRECTS */