3 #ifndef SCM_THREADS_PLUGIN_H
4 #define SCM_THREADS_PLUGIN_H
6 /* Copyright (C) 1996,1997,1998,2000,2001, 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
24 #include <pthread.h> /* This file should *not* need to include pthread.h */
26 /* Size is checked in scm_init_threads_plugin */
27 #define SCM_MUTEX_MAXSIZE (9 * sizeof (long))
28 typedef struct { char _
[SCM_MUTEX_MAXSIZE
]; } scm_t_mutex
;
30 /*fixme* Should be defined similarly to scm_t_mutex. */
31 #define scm_t_mutexattr pthread_mutexattr_t
33 extern int scm_i_plugin_mutex_size
;
34 typedef int (*scm_t_mutex_init
) (scm_t_mutex
*, const scm_t_mutexattr
*);
35 typedef int (*scm_t_mutex_lock
) (scm_t_mutex
*);
36 typedef int (*scm_t_mutex_unlock
) (scm_t_mutex
*);
37 extern scm_t_mutex_init scm_i_plugin_mutex_init
;
38 extern scm_t_mutex_lock scm_i_plugin_mutex_lock
;
39 extern scm_t_mutex_unlock scm_i_plugin_mutex_unlock
;
41 /* Size is checked in scm_init_threads_plugin */
42 #define SCM_REC_MUTEX_MAXSIZE (SCM_MUTEX_MAXSIZE + 3 * sizeof (long))
43 typedef struct { char _
[SCM_REC_MUTEX_MAXSIZE
]; } scm_t_rec_mutex
;
45 extern int scm_i_plugin_rec_mutex_size
;
46 typedef int (*scm_t_rec_mutex_init
) (scm_t_rec_mutex
*,
47 const scm_t_mutexattr
*);
48 typedef int (*scm_t_rec_mutex_destroy
) (scm_t_rec_mutex
*);
49 typedef int (*scm_t_rec_mutex_lock
) (scm_t_rec_mutex
*);
50 typedef int (*scm_t_rec_mutex_trylock
) (scm_t_rec_mutex
*);
51 typedef int (*scm_t_rec_mutex_unlock
) (scm_t_rec_mutex
*);
52 extern scm_t_rec_mutex_init scm_i_plugin_rec_mutex_init
;
53 extern scm_t_rec_mutex_destroy scm_i_plugin_rec_mutex_destroy
;
54 extern scm_t_rec_mutex_lock scm_i_plugin_rec_mutex_lock
;
55 extern scm_t_rec_mutex_trylock scm_i_plugin_rec_mutex_trylock
;
56 extern scm_t_rec_mutex_unlock scm_i_plugin_rec_mutex_unlock
;
59 #define scm_t_cond pthread_cond_t
61 typedef int (*scm_t_cond_wait
) (scm_t_cond
*, scm_t_mutex
*);
62 typedef int (*scm_t_cond_timedwait
) (scm_t_cond
*,
64 const scm_t_timespec
*);
65 extern scm_t_cond_wait scm_i_plugin_cond_wait
;
66 extern scm_t_cond_timedwait scm_i_plugin_cond_timedwait
;
68 extern void scm_init_threads_plugin (void);
70 #endif /* SCM_THREADS_PLUGIN_H */