46 |
|
|
47 |
|
|
48 |
|
|
49 |
/* The pthreads-threads implementation. This is a very simple mapping. |
/* The pthreads-threads implementation. This is a direct mapping. |
50 |
*/ |
*/ |
51 |
|
|
52 |
|
/* This is an interface between Guile and the pthreads thread package. */ |
53 |
|
|
54 |
#include <pthread.h> |
#include <pthread.h> |
55 |
|
|
56 |
#define scm_t_thread pthread_t |
/* MDJ 021209 <djurfeldt@nada.kth.se>: |
57 |
|
The separation of the plugin interface and the low-level C API |
58 |
|
(currently in threads.h) needs to be completed in a sensible way. |
59 |
|
*/ |
60 |
|
|
61 |
|
/* The scm_t_ types are temporarily used both in plugin and low-level API */ |
62 |
|
#define scm_t_thread pthread_t |
63 |
|
|
64 |
|
#define scm_i_plugin_thread_create pthread_create |
65 |
|
|
66 |
|
#define scm_i_plugin_thread_join pthread_join |
67 |
|
#define scm_i_plugin_thread_detach pthread_detach |
68 |
|
#define scm_i_plugin_thread_self pthread_self |
69 |
|
|
70 |
|
#define scm_t_mutex pthread_mutex_t |
71 |
|
|
72 |
|
#define scm_i_plugin_mutex_init pthread_mutex_init |
73 |
|
#define scm_i_plugin_mutex_destroy pthread_mutex_destroy |
74 |
|
#define scm_i_plugin_mutex_lock pthread_mutex_lock |
75 |
|
#define scm_i_plugin_mutex_trylock pthread_mutex_trylock |
76 |
|
#define scm_i_plugin_mutex_unlock pthread_mutex_unlock |
77 |
|
|
78 |
|
#define scm_t_cond pthread_cond_t |
79 |
|
|
80 |
|
#define scm_i_plugin_cond_init pthread_cond_init |
81 |
|
#define scm_i_plugin_cond_destroy pthread_cond_destroy |
82 |
|
#define scm_i_plugin_cond_wait pthread_cond_wait |
83 |
|
#define scm_i_plugin_cond_timedwait pthread_cond_timedwait |
84 |
|
#define scm_i_plugin_cond_signal pthread_cond_signal |
85 |
|
#define scm_i_plugin_cond_broadcast pthread_cond_broadcast |
86 |
|
|
87 |
#define scm_thread_create(th,proc,data) \ |
#define scm_t_key pthread_key_t |
|
pthread_create ((th), NULL, (void *(*)(void *))(proc), (data)) |
|
88 |
|
|
89 |
#define scm_thread_join(th) pthread_join (th, NULL) |
#define scm_i_plugin_key_create pthread_key_create |
90 |
#define scm_thread_detach(th) pthread_detach (th) |
#define scm_i_plugin_key_delete pthread_key_delete |
91 |
#define scm_thread_self() pthread_self () |
#define scm_i_plugin_setspecific pthread_setspecific |
92 |
|
#define scm_i_plugin_getspecific pthread_getspecific |
|
#define scm_t_mutex pthread_mutex_t |
|
|
|
|
|
#define scm_mutex_init(mx) pthread_mutex_init (mx, NULL) |
|
|
#define scm_mutex_destroy(mx) pthread_mutex_destroy (mx) |
|
|
#define scm_mutex_lock(mx) pthread_mutex_lock (mx) |
|
|
#define scm_mutex_trylock(mx) pthread_mutex_trylock (mx) |
|
|
#define scm_mutex_unlock(mx) pthread_mutex_unlock (mx) |
|
|
|
|
|
#define scm_t_cond pthread_cond_t |
|
|
|
|
|
#define scm_cond_init(cv) pthread_cond_init (cv, NULL) |
|
|
#define scm_cond_destroy(cv) pthread_cond_destroy (cv) |
|
|
#define scm_cond_wait(cv,mx) pthread_cond_wait (cv, mx) |
|
|
#define scm_cond_timedwait(cv,mx,at) \ |
|
|
pthread_cond_timedwait (cv, mx, at) |
|
|
#define scm_cond_signal(cv) pthread_cond_signal (cv) |
|
|
#define scm_cond_broadcast(cv) \ |
|
|
pthread_cond_broadcast (cv) |
|
|
|
|
|
#define scm_t_key pthread_key_t |
|
|
|
|
|
#define scm_key_create(keyp) pthread_key_create (keyp, NULL) |
|
|
#define scm_key_delete(key) pthread_key_delete (key) |
|
|
#define scm_key_setspecific(key, value) \ |
|
|
pthread_setspecific (key, value) |
|
|
#define scm_key_getspecific(key) \ |
|
|
pthread_getspecific (key) |
|
93 |
|
|
94 |
#define scm_thread_select select |
#define scm_i_plugin_select select |
95 |
|
|
96 |
#endif /* SCM_THREADS_NULL_H */ |
#endif /* SCM_THREADS_NULL_H */ |
97 |
|
|