REPL Server: Don't establish a SIGINT handler.
[bpt/guile.git] / libguile / pthread-threads.h
CommitLineData
eac85310
MV
1/* classes: h_files */
2
9de87eea
MV
3#ifndef SCM_PTHREADS_THREADS_H
4#define SCM_PTHREADS_THREADS_H
eac85310 5
12c1d861 6/* Copyright (C) 2002, 2005, 2006, 2011 Free Software Foundation, Inc.
eac85310 7 *
73be1d9e 8 * This library is free software; you can redistribute it and/or
53befeb7
NJ
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
eac85310 12 *
53befeb7
NJ
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
73be1d9e
MV
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
eac85310 17 *
73be1d9e
MV
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
53befeb7
NJ
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301 USA
73be1d9e 22 */
eac85310
MV
23
24\f
25
9bc4701c 26/* The pthreads-threads implementation. This is a direct mapping.
eac85310
MV
27*/
28
29#include <pthread.h>
0b6843b1 30#include <sched.h>
eac85310 31
12c1d861 32/* `libgc' defines wrapper procedures for pthread calls. */
1c44468d 33#include "libguile/bdw-gc.h"
89f423d5 34
9de87eea
MV
35/* Threads
36*/
37#define scm_i_pthread_t pthread_t
38#define scm_i_pthread_self pthread_self
12c1d861
AW
39#define scm_i_pthread_create GC_pthread_create
40#define scm_i_pthread_detach GC_pthread_detach
8cf49d83
AW
41
42#if SCM_HAVE_GC_PTHREAD_EXIT
12c1d861 43#define scm_i_pthread_exit GC_pthread_exit
8cf49d83
AW
44#else
45#define scm_i_pthread_exit pthread_exit
46#endif
47
48#if SCM_HAVE_GC_PTHREAD_CANCEL
12c1d861 49#define scm_i_pthread_cancel GC_pthread_cancel
8cf49d83
AW
50#else
51#define scm_i_pthread_cancel pthread_cancel
52#endif
53
2e77f720
LC
54#define scm_i_pthread_cleanup_push pthread_cleanup_push
55#define scm_i_pthread_cleanup_pop pthread_cleanup_pop
9de87eea
MV
56#define scm_i_sched_yield sched_yield
57
58/* Signals
9bc4701c 59 */
90fed973 60#if SCM_HAVE_GC_PTHREAD_SIGMASK
12c1d861 61#define scm_i_pthread_sigmask GC_pthread_sigmask
90fed973
AW
62#else
63#define scm_i_pthread_sigmask pthread_sigmask
64#endif
9bc4701c 65
9de87eea
MV
66/* Mutexes
67 */
66302618
LC
68#if SCM_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER
69# define SCM_I_PTHREAD_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }
70#else
71# define SCM_I_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
72#endif
9de87eea
MV
73#define scm_i_pthread_mutex_t pthread_mutex_t
74#define scm_i_pthread_mutex_init pthread_mutex_init
75#define scm_i_pthread_mutex_destroy pthread_mutex_destroy
76#define scm_i_pthread_mutex_trylock pthread_mutex_trylock
77#define scm_i_pthread_mutex_lock pthread_mutex_lock
78#define scm_i_pthread_mutex_unlock pthread_mutex_unlock
d1138028 79extern pthread_mutexattr_t scm_i_pthread_mutexattr_recursive[1];
9de87eea
MV
80
81/* Condition variables
82 */
83#define SCM_I_PTHREAD_COND_INITIALIZER PTHREAD_COND_INITIALIZER
84#define scm_i_pthread_cond_t pthread_cond_t
85#define scm_i_pthread_cond_init pthread_cond_init
86#define scm_i_pthread_cond_destroy pthread_cond_destroy
87#define scm_i_pthread_cond_signal pthread_cond_signal
88#define scm_i_pthread_cond_broadcast pthread_cond_broadcast
89#define scm_i_pthread_cond_wait pthread_cond_wait
90#define scm_i_pthread_cond_timedwait pthread_cond_timedwait
91
92/* Onces
93 */
94#define scm_i_pthread_once_t pthread_once_t
9de87eea 95#define scm_i_pthread_once pthread_once
8ab3d8a0
KR
96#if SCM_NEED_BRACES_ON_PTHREAD_ONCE_INIT
97#define SCM_I_PTHREAD_ONCE_INIT { PTHREAD_ONCE_INIT }
98#else
99#define SCM_I_PTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
100#endif
eac85310 101
9de87eea
MV
102/* Thread specific storage
103 */
104#define scm_i_pthread_key_t pthread_key_t
105#define scm_i_pthread_key_create pthread_key_create
106#define scm_i_pthread_setspecific pthread_setspecific
107#define scm_i_pthread_getspecific pthread_getspecific
e29e0b09 108
9de87eea
MV
109/* Convenience functions
110 */
111#define scm_i_scm_pthread_mutex_lock scm_pthread_mutex_lock
661ae7ab 112#define scm_i_dynwind_pthread_mutex_lock scm_dynwind_pthread_mutex_lock
9de87eea
MV
113#define scm_i_scm_pthread_cond_wait scm_pthread_cond_wait
114#define scm_i_scm_pthread_cond_timedwait scm_pthread_cond_timedwait
28d52ebb 115
9de87eea 116#endif /* SCM_PTHREADS_THREADS_H */
eac85310
MV
117
118/*
119 Local Variables:
120 c-file-style: "gnu"
121 End:
122*/