summaryrefslogtreecommitdiff
path: root/libguile/pthread-threads.h
diff options
context:
space:
mode:
authorMikael Djurfeldt <djurfeldt@nada.kth.se>2002-12-16 09:28:38 +0000
committerMikael Djurfeldt <djurfeldt@nada.kth.se>2002-12-16 09:28:38 +0000
commit93cd4dcd9c37f3ee1401742dcc81ec192209b5ff (patch)
tree7f01ce64b2b3bcd4bef27559777c39f39f115f5f /libguile/pthread-threads.h
parent09841c77838b6263c666036f1e81c82cbe8e152e (diff)
downloadguile-93cd4dcd9c37f3ee1401742dcc81ec192209b5ff.tar.gz
* pthread-threads.c, pthread-threads.h, threads.c: Fixes to
pthread "native" recursive mutex support.
Diffstat (limited to 'libguile/pthread-threads.h')
-rw-r--r--libguile/pthread-threads.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/libguile/pthread-threads.h b/libguile/pthread-threads.h
index 1dd7e5bc4..006d06b3c 100644
--- a/libguile/pthread-threads.h
+++ b/libguile/pthread-threads.h
@@ -78,17 +78,23 @@ extern scm_t_mutexattr scm_i_plugin_mutex; /* The "fast" mutex. */
#define scm_i_plugin_mutex_trylock pthread_mutex_trylock
#define scm_i_plugin_mutex_unlock pthread_mutex_unlock
+/* Size is checked in scm_init_pthread_threads */
#define SCM_REC_MUTEX_MAXSIZE (8 * sizeof (long))
typedef struct { char _[SCM_REC_MUTEX_MAXSIZE]; } scm_t_rec_mutex;
extern scm_t_mutexattr scm_i_plugin_rec_mutex;
-#ifdef PTHREAD_MUTEX_RECURSIVE /* pthreads has recursive mutexes! */
-#define scm_i_plugin_rec_mutex_init pthread_mutex_init
-#define scm_i_plugin_rec_mutex_destroy pthread_mutex_destroy
-#define scm_i_plugin_rec_mutex_lock pthread_mutex_lock
-#define scm_i_plugin_rec_mutex_trylock pthread_mutex_trylock
-#define scm_i_plugin_rec_mutex_unlock pthread_mutex_unlock
+#ifdef SCM_MUTEX_RECURSIVE /* pthreads has recursive mutexes! */
+#define scm_i_plugin_rec_mutex_init(m,a) \
+ pthread_mutex_init ((pthread_mutex_t *) (m), (a))
+#define scm_i_plugin_rec_mutex_destroy(m) \
+ pthread_mutex_destroy ((pthread_mutex_t *) (m))
+#define scm_i_plugin_rec_mutex_lock(m) \
+ pthread_mutex_lock ((pthread_mutex_t *) (m))
+#define scm_i_plugin_rec_mutex_trylock(m) \
+ pthread_mutex_trylock ((pthread_mutex_t *) (m))
+#define scm_i_plugin_rec_mutex_unlock(m) \
+ pthread_mutex_unlock ((pthread_mutex_t *) (m))
#else
int scm_i_plugin_rec_mutex_init (scm_t_rec_mutex *, const scm_t_mutexattr *);
#define scm_i_plugin_rec_mutex_destroy(mx) do { (void) (mx); } while (0)
@@ -117,7 +123,7 @@ int scm_i_plugin_rec_mutex_unlock (scm_t_rec_mutex *);
void scm_init_pthread_threads (void);
-#endif /* SCM_THREADS_NULL_H */
+#endif /* SCM_THREADS_PTHREADS_H */
/*
Local Variables: