(scm_frame_current_module): New.
[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
MV
5
6/* Copyright (C) 2002 Free Software Foundation, Inc.
7 *
73be1d9e
MV
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.
3d527b27 12 *
73be1d9e 13 * This library is distributed in the hope that it will be useful,
3d527b27 14 * but 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
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
3d527b27
MV
22
23\f
24
25/* The null-threads implementation. We provide the standard API, but
26 no new threads can be created.
27*/
28
9bc4701c
MD
29#error temporarily broken, compile with threads enabled (default option)
30
d0350293
MV
31/* We can't switch so don't bother trying.
32*/
33#undef SCM_THREAD_SWITCHING_CODE
3d527b27
MV
34#define SCM_THREAD_SWITCHING_CODE
35
d0350293
MV
36#define scm_t_thread int
37
38/* The "(void)(...)" constructs in the expansions are there to ensure
39 that the side effects of the argument expressions take place.
40*/
41
42#define scm_thread_create(th,proc,data) ((void)(proc), (void)(data), ENOTSUP)
43#define scm_thread_join(th) do { (void)(th); abort(); } while(0)
44#define scm_thread_detach(th) do { (void)(th); abort(); } while(0)
45#define scm_thread_self() 0
46
47#define scm_t_mutex int
48
49#define scm_mutex_init(mx) do { (void)(mx); } while(0)
50#define scm_mutex_destroy(mx) do { (void)(mx); } while(0)
51#define scm_mutex_lock(mx) do { (void)(mx); } while(0)
52#define scm_mutex_trylock(mx) ((void)(mx), 1)
53#define scm_mutex_unlock(mx) do { (void)(mx); } while(0)
54
55#define scm_t_cond int
56
57#define scm_cond_init(cv) do { (void)(cv); } while(0)
58#define scm_cond_destroy(cv) do { (void)(cv); } while(0)
59#define scm_cond_wait(cv,mx) ((void)(cv), (void)(mx), ENOTSUP)
60#define scm_cond_timedwait(cv,mx,at) ((void)(cv), (void)(mx), (void)(at), \
61 ENOTSUP)
62#define scm_cond_signal(cv) do { (void)(cv); } while(0)
63#define scm_cond_broadcast(cv) do { (void)(cv); } while(0)
64
65#define scm_thread_select select
66
67typedef void **scm_t_key;
68
69#define scm_key_create(keyp) do { *(keyp) = malloc(sizeof(void*)); \
70 } while(0)
71#define scm_key_delete(key) do { free(key); } while(0)
72#define scm_key_setspecific(key, value) do { *(key) = (value); } while(0)
73#define scm_key_getspecific(key) *(key)
74
75#if 0
76
77/* These are the actual prototypes of the functions/macros defined
78 above. We list them here for reference. */
79
80typedef int scm_t_thread;
81
82SCM_API int scm_thread_create (scm_t_thread *th,
83 void (*proc) (void *), void *data);
84SCM_API void scm_thread_join (scm_t_thread th);
85SCM_API void scm_thread_detach (scm_t_thread th);
86SCM_API scm_t_thread scm_thread_self (void);
87
88typedef int scm_t_mutex;
89
90SCM_API void scm_mutex_init (scm_t_mutex *mx);
91SCM_API void scm_mutex_destroy (scm_t_mutex *mx);
92SCM_API void scm_mutex_lock (scm_t_mutex *mx);
93SCM_API int scm_mutex_trylock (scm_t_mutex *mx);
94SCM_API void scm_mutex_unlock (scm_t_mutex *mx);
95
96typedef int scm_t_cond;
97
98SCM_API void scm_cond_init (scm_t_cond *cv);
99SCM_API void scm_cond_destroy (scm_t_cond *cv);
100SCM_API void scm_cond_wait (scm_t_cond *cv, scm_t_mutex *mx);
101SCM_API int scm_cond_timedwait (scm_t_cond *cv, scm_t_mutex *mx,
bf44fc4d 102 scm_t_timespec *abstime);
d0350293
MV
103SCM_API void scm_cond_signal (scm_t_cond *cv);
104SCM_API void scm_cond_broadcast (scm_t_cond *cv);
105
106typedef int scm_t_key;
107
108SCM_API void scm_key_create (scm_t_key *keyp);
109SCM_API void scm_key_delete (scm_t_key key);
110SCM_API void scm_key_setspecific (scm_t_key key, const void *value);
111SCM_API void *scm_key_getspecific (scm_t_key key);
112
113SCM_API int scm_thread_select (int nfds,
114 SELECT_TYPE *readfds,
115 SELECT_TYPE *writefds,
116 SELECT_TYPE *exceptfds,
117 struct timeval *timeout);
3d527b27 118
d0350293 119#endif
3d527b27 120
d0350293 121#endif /* SCM_NULL_THREADS_H */
3d527b27
MV
122
123/*
124 Local Variables:
125 c-file-style: "gnu"
126 End:
127*/