Simplify the interpreter for trivial inits and no letrec
[bpt/guile.git] / libguile / pthread-threads.h
... / ...
CommitLineData
1/* classes: h_files */
2
3#ifndef SCM_PTHREADS_THREADS_H
4#define SCM_PTHREADS_THREADS_H
5
6/* Copyright (C) 2002, 2005, 2006, 2011 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 License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * 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
21 * 02110-1301 USA
22 */
23
24\f
25
26/* The pthreads-threads implementation. This is a direct mapping.
27*/
28
29#include <pthread.h>
30#include <sched.h>
31
32/* Threads
33*/
34#define scm_i_pthread_t pthread_t
35#define scm_i_pthread_self pthread_self
36#define scm_i_pthread_create pthread_create
37#define scm_i_pthread_detach pthread_detach
38
39#define scm_i_pthread_exit pthread_exit
40#define scm_i_pthread_cancel pthread_cancel
41
42#define scm_i_pthread_cleanup_push pthread_cleanup_push
43#define scm_i_pthread_cleanup_pop pthread_cleanup_pop
44#define scm_i_sched_yield sched_yield
45
46/* Signals
47 */
48#define scm_i_pthread_sigmask pthread_sigmask
49
50/* Mutexes
51 */
52#if SCM_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER
53# define SCM_I_PTHREAD_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER }
54#else
55# define SCM_I_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
56#endif
57#define scm_i_pthread_mutex_t pthread_mutex_t
58#define scm_i_pthread_mutex_init pthread_mutex_init
59#define scm_i_pthread_mutex_destroy pthread_mutex_destroy
60#define scm_i_pthread_mutex_trylock pthread_mutex_trylock
61#define scm_i_pthread_mutex_lock pthread_mutex_lock
62#define scm_i_pthread_mutex_unlock pthread_mutex_unlock
63extern pthread_mutexattr_t scm_i_pthread_mutexattr_recursive[1];
64
65/* Condition variables
66 */
67#define SCM_I_PTHREAD_COND_INITIALIZER PTHREAD_COND_INITIALIZER
68#define scm_i_pthread_cond_t pthread_cond_t
69#define scm_i_pthread_cond_init pthread_cond_init
70#define scm_i_pthread_cond_destroy pthread_cond_destroy
71#define scm_i_pthread_cond_signal pthread_cond_signal
72#define scm_i_pthread_cond_broadcast pthread_cond_broadcast
73#define scm_i_pthread_cond_wait pthread_cond_wait
74#define scm_i_pthread_cond_timedwait pthread_cond_timedwait
75
76/* Onces
77 */
78#define scm_i_pthread_once_t pthread_once_t
79#define scm_i_pthread_once pthread_once
80#if SCM_NEED_BRACES_ON_PTHREAD_ONCE_INIT
81#define SCM_I_PTHREAD_ONCE_INIT { PTHREAD_ONCE_INIT }
82#else
83#define SCM_I_PTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
84#endif
85
86/* Thread specific storage
87 */
88#define scm_i_pthread_key_t pthread_key_t
89#define scm_i_pthread_key_create pthread_key_create
90#define scm_i_pthread_setspecific pthread_setspecific
91#define scm_i_pthread_getspecific pthread_getspecific
92
93/* Convenience functions
94 */
95#define scm_i_scm_pthread_mutex_lock scm_pthread_mutex_lock
96#define scm_i_dynwind_pthread_mutex_lock scm_dynwind_pthread_mutex_lock
97#define scm_i_scm_pthread_cond_wait scm_pthread_cond_wait
98#define scm_i_scm_pthread_cond_timedwait scm_pthread_cond_timedwait
99
100#endif /* SCM_PTHREADS_THREADS_H */
101
102/*
103 Local Variables:
104 c-file-style: "gnu"
105 End:
106*/