Use thread-local allocation (significant perf. improvement!); added the `boehm-gc...
[bpt/guile.git] / libguile / pthread-threads.h
1 /* classes: h_files */
2
3 #ifndef SCM_PTHREADS_THREADS_H
4 #define SCM_PTHREADS_THREADS_H
5
6 /* Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 \f
24
25 /* The pthreads-threads implementation. This is a direct mapping.
26 */
27
28 #include <pthread.h>
29 #include <sched.h>
30
31 /* `libgc' intercepts pthread calls by defining wrapping macros. */
32 #include "libguile/boehm-gc.h"
33
34 /* Threads
35 */
36 #define scm_i_pthread_t pthread_t
37 #define scm_i_pthread_self pthread_self
38 #define scm_i_pthread_create pthread_create
39 #define scm_i_pthread_detach pthread_detach
40 #define scm_i_pthread_exit pthread_exit
41 #define scm_i_sched_yield sched_yield
42
43 /* Signals
44 */
45 #define scm_i_pthread_sigmask pthread_sigmask
46
47 /* Mutexes
48 */
49 #define SCM_I_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
50 #define scm_i_pthread_mutex_t pthread_mutex_t
51 #define scm_i_pthread_mutex_init pthread_mutex_init
52 #define scm_i_pthread_mutex_destroy pthread_mutex_destroy
53 #define scm_i_pthread_mutex_trylock pthread_mutex_trylock
54 #define scm_i_pthread_mutex_lock pthread_mutex_lock
55 #define scm_i_pthread_mutex_unlock pthread_mutex_unlock
56 extern pthread_mutexattr_t scm_i_pthread_mutexattr_recursive[1];
57
58 /* Condition variables
59 */
60 #define SCM_I_PTHREAD_COND_INITIALIZER PTHREAD_COND_INITIALIZER
61 #define scm_i_pthread_cond_t pthread_cond_t
62 #define scm_i_pthread_cond_init pthread_cond_init
63 #define scm_i_pthread_cond_destroy pthread_cond_destroy
64 #define scm_i_pthread_cond_signal pthread_cond_signal
65 #define scm_i_pthread_cond_broadcast pthread_cond_broadcast
66 #define scm_i_pthread_cond_wait pthread_cond_wait
67 #define scm_i_pthread_cond_timedwait pthread_cond_timedwait
68
69 /* Onces
70 */
71 #define scm_i_pthread_once_t pthread_once_t
72 #define SCM_I_PTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
73 #define scm_i_pthread_once pthread_once
74
75 /* Thread specific storage
76 */
77 #define scm_i_pthread_key_t pthread_key_t
78 #define scm_i_pthread_key_create pthread_key_create
79 #define scm_i_pthread_setspecific pthread_setspecific
80 #define scm_i_pthread_getspecific pthread_getspecific
81
82 /* Convenience functions
83 */
84 #define scm_i_scm_pthread_mutex_lock scm_pthread_mutex_lock
85 #define scm_i_dynwind_pthread_mutex_lock scm_dynwind_pthread_mutex_lock
86 #define scm_i_scm_pthread_cond_wait scm_pthread_cond_wait
87 #define scm_i_scm_pthread_cond_timedwait scm_pthread_cond_timedwait
88
89 #endif /* SCM_PTHREADS_THREADS_H */
90
91 /*
92 Local Variables:
93 c-file-style: "gnu"
94 End:
95 */