Commit | Line | Data |
---|---|---|
eac85310 MV |
1 | /* classes: h_files */ |
2 | ||
3 | #ifndef SCM_THREADS_PTHREADS_H | |
4 | #define SCM_THREADS_PTHREADS_H | |
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. | |
eac85310 | 12 | * |
73be1d9e | 13 | * This library is distributed in the hope that it will be useful, |
eac85310 | 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. | |
eac85310 | 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 | */ | |
eac85310 MV |
22 | |
23 | \f | |
24 | ||
9bc4701c | 25 | /* The pthreads-threads implementation. This is a direct mapping. |
eac85310 MV |
26 | */ |
27 | ||
9bc4701c MD |
28 | /* This is an interface between Guile and the pthreads thread package. */ |
29 | ||
eac85310 | 30 | #include <pthread.h> |
0b6843b1 | 31 | #include <sched.h> |
eac85310 | 32 | |
29717c89 MD |
33 | #include "libguile/threads-plugin.h" |
34 | ||
9bc4701c MD |
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. | |
38 | */ | |
39 | ||
40 | /* The scm_t_ types are temporarily used both in plugin and low-level API */ | |
41 | #define scm_t_thread pthread_t | |
eac85310 | 42 | |
9bc4701c | 43 | #define scm_i_plugin_thread_create pthread_create |
eac85310 | 44 | |
9bc4701c MD |
45 | #define scm_i_plugin_thread_join pthread_join |
46 | #define scm_i_plugin_thread_detach pthread_detach | |
0b6843b1 MD |
47 | #define scm_i_plugin_thread_self pthread_self |
48 | #define scm_i_plugin_thread_yield sched_yield | |
eac85310 | 49 | |
28d52ebb | 50 | extern scm_t_mutexattr scm_i_plugin_mutex; /* The "fast" mutex. */ |
eac85310 | 51 | |
0b6843b1 MD |
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)) | |
eac85310 | 56 | |
28d52ebb MD |
57 | extern scm_t_mutexattr scm_i_plugin_rec_mutex; |
58 | ||
9bc4701c | 59 | #define scm_i_plugin_cond_init pthread_cond_init |
6da2dfc4 | 60 | #define scm_i_plugin_cond_destroy pthread_cond_destroy |
9bc4701c MD |
61 | #define scm_i_plugin_cond_signal pthread_cond_signal |
62 | #define scm_i_plugin_cond_broadcast pthread_cond_broadcast | |
eac85310 | 63 | |
9bc4701c | 64 | #define scm_t_key pthread_key_t |
eac85310 | 65 | |
9bc4701c MD |
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 | |
eac85310 | 70 | |
9bc4701c | 71 | #define scm_i_plugin_select select |
eac85310 | 72 | |
e29e0b09 MD |
73 | #ifdef SCM_DEBUG_THREADS |
74 | void scm_i_assert_heap_locked (void); | |
75 | #endif | |
76 | ||
28d52ebb MD |
77 | void scm_init_pthread_threads (void); |
78 | ||
93cd4dcd | 79 | #endif /* SCM_THREADS_PTHREADS_H */ |
eac85310 MV |
80 | |
81 | /* | |
82 | Local Variables: | |
83 | c-file-style: "gnu" | |
84 | End: | |
85 | */ |