Remove unused macros in goops.c
[bpt/guile.git] / libguile / null-threads.h
CommitLineData
3d527b27
MV
1/* classes: h_files */
2
d0350293
MV
3#ifndef SCM_NULL_THREADS_H
4#define SCM_NULL_THREADS_H
3d527b27 5
2bf0e122 6/* Copyright (C) 2005, 2006, 2010 Free Software Foundation, Inc.
3d527b27 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.
3d527b27 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.
3d527b27 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 */
3d527b27
MV
23
24\f
25
9de87eea
MV
26/* The null-threads implementation. We provide the subset of the
27 standard pthread API that is used by Guile, but no new threads can
28 be created.
9bc4701c 29
9de87eea
MV
30 This file merely exits so that Guile can be compiled and run
31 without using pthreads. Improving performance via optimizations
32 that are possible in a single-threaded program is not a primary
33 goal.
d0350293 34*/
3d527b27 35
93003b16 36#include <stdlib.h>
9de87eea 37#include <errno.h>
d0350293 38
93003b16 39/* Threads
d0350293 40*/
9de87eea
MV
41#define scm_i_pthread_t int
42#define scm_i_pthread_self() 0
43#define scm_i_pthread_create(t,a,f,d) (*(t)=0, (void)(f), ENOSYS)
44#define scm_i_pthread_detach(t) do { } while (0)
93003b16 45#define scm_i_pthread_exit(v) exit (EXIT_SUCCESS)
2e77f720
LC
46#define scm_i_pthread_cancel(t) 0
47#define scm_i_pthread_cleanup_push(t,v) 0
48#define scm_i_pthread_cleanup_pop(e) 0
9de87eea
MV
49#define scm_i_sched_yield() 0
50
51/* Signals
52 */
53#define scm_i_pthread_sigmask sigprocmask
d0350293 54
9de87eea
MV
55/* Mutexes
56 */
57#define SCM_I_PTHREAD_MUTEX_INITIALIZER 0
9de87eea
MV
58#define scm_i_pthread_mutex_t int
59#define scm_i_pthread_mutex_init(m,a) (*(m) = 0)
60#define scm_i_pthread_mutex_destroy(m) do { (void)(m); } while(0)
61#define scm_i_pthread_mutex_trylock(m) ((*(m))++)
62#define scm_i_pthread_mutex_lock(m) ((*(m))++)
63#define scm_i_pthread_mutex_unlock(m) ((*(m))--)
d1138028 64#define scm_i_pthread_mutexattr_recursive 0
9de87eea
MV
65
66/* Condition variables
67 */
68#define SCM_I_PTHREAD_COND_INITIALIZER 0
69#define scm_i_pthread_cond_t int
70#define scm_i_pthread_cond_init(c,a) (*(c) = 0)
71#define scm_i_pthread_cond_destroy(c) do { (void)(c); } while(0)
72#define scm_i_pthread_cond_signal(c) (*(c) = 1)
73#define scm_i_pthread_cond_broadcast(c) (*(c) = 1)
74#define scm_i_pthread_cond_wait(c,m) (abort(), 0)
75#define scm_i_pthread_cond_timedwait(c,m,t) (abort(), 0)
76
77/* Onces
78 */
79#define scm_i_pthread_once_t int
80#define SCM_I_PTHREAD_ONCE_INIT 0
81#define scm_i_pthread_once(o,f) do { \
82 if(!*(o)) { *(o)=1; f (); } \
83 } while(0)
d0350293 84
9de87eea
MV
85/* Thread specific storage
86 */
87typedef struct scm_i_pthread_key_t {
88 struct scm_i_pthread_key_t *next;
89 void *value;
90 void (*destr_func) (void *);
91} scm_i_pthread_key_t;
92
93SCM_API int scm_i_pthread_key_create (scm_i_pthread_key_t *key,
94 void (*destr_func) (void *));
95#define scm_i_pthread_setspecific(k,p) ((k).value = (p))
96#define scm_i_pthread_getspecific(k) ((k).value)
97
98/* Convenience functions
99 */
100#define scm_i_scm_pthread_mutex_lock scm_i_pthread_mutex_lock
661ae7ab 101#define scm_i_dynwind_pthread_mutex_lock scm_i_pthread_mutex_lock
9de87eea
MV
102#define scm_i_scm_pthread_cond_wait scm_i_pthread_cond_wait
103#define scm_i_scm_pthread_cond_timedwait scm_i_pthread_cond_timedwait
3d527b27 104
3d527b27 105
d0350293 106#endif /* SCM_NULL_THREADS_H */
3d527b27
MV
107
108/*
109 Local Variables:
110 c-file-style: "gnu"
111 End:
112*/