3 #ifndef SCM_THREADS_PTHREADS_H
4 #define SCM_THREADS_PTHREADS_H
6 /* Copyright (C) 2002 Free Software Foundation, Inc.
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.
13 * This library is distributed in the hope that it will be useful,
14 * but 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.
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
25 /* The pthreads-threads implementation. This is a direct mapping.
28 /* This is an interface between Guile and the pthreads thread package. */
33 #include "libguile/threads-plugin.h"
35 /* MDJ 021209 <djurfeldt@nada.kth.se>:
36 The separation of the plugin interface and the low-level C API
37 (currently in threads.h) needs to be completed in a sensible way.
40 /* The scm_t_ types are temporarily used both in plugin and low-level API */
41 #define scm_t_thread pthread_t
43 #define scm_i_plugin_thread_create pthread_create
45 #define scm_i_plugin_thread_join pthread_join
46 #define scm_i_plugin_thread_detach pthread_detach
47 #define scm_i_plugin_thread_self pthread_self
48 #define scm_i_plugin_thread_yield sched_yield
50 extern scm_t_mutexattr scm_i_plugin_mutex
; /* The "fast" mutex. */
52 #define scm_i_plugin_mutex_destroy(m) \
53 pthread_mutex_destroy ((pthread_mutex_t *) (m))
54 #define scm_i_plugin_mutex_trylock(m) \
55 pthread_mutex_trylock ((pthread_mutex_t *) (m))
57 extern scm_t_mutexattr scm_i_plugin_rec_mutex
;
59 #define scm_i_plugin_cond_init pthread_cond_init
60 #define scm_i_plugin_cond_destroy pthread_cond_destroy
61 #define scm_i_plugin_cond_signal pthread_cond_signal
62 #define scm_i_plugin_cond_broadcast pthread_cond_broadcast
64 #define scm_t_key pthread_key_t
66 #define scm_i_plugin_key_create pthread_key_create
67 #define scm_i_plugin_key_delete pthread_key_delete
68 #define scm_i_plugin_setspecific pthread_setspecific
69 #define scm_i_plugin_getspecific pthread_getspecific
71 #define scm_i_plugin_select select
73 #ifdef SCM_DEBUG_THREADS
74 void scm_i_assert_heap_locked (void);
77 void scm_init_pthread_threads (void);
79 #endif /* SCM_THREADS_PTHREADS_H */