| 1 | /* classes: h_files */ |
| 2 | |
| 3 | #ifndef SCM_THREADS_PLUGIN_H |
| 4 | #define SCM_THREADS_PLUGIN_H |
| 5 | |
| 6 | /* Copyright (C) 1996,1997,1998,2000,2001, 2002 Free Software Foundation, Inc. |
| 7 | * |
| 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. |
| 12 | * |
| 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. |
| 17 | * |
| 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 | */ |
| 22 | |
| 23 | \f |
| 24 | #include <pthread.h> /* This file should *not* need to include pthread.h */ |
| 25 | |
| 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; |
| 29 | |
| 30 | /*fixme* Should be defined similarly to scm_t_mutex. */ |
| 31 | #define scm_t_mutexattr pthread_mutexattr_t |
| 32 | |
| 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; |
| 40 | |
| 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; |
| 44 | |
| 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; |
| 57 | |
| 58 | /*fixme*/ |
| 59 | #define scm_t_cond pthread_cond_t |
| 60 | |
| 61 | typedef int (*scm_t_cond_wait) (scm_t_cond *, scm_t_mutex *); |
| 62 | typedef int (*scm_t_cond_timedwait) (scm_t_cond *, |
| 63 | scm_t_mutex *, |
| 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; |
| 67 | |
| 68 | extern void scm_init_threads_plugin (void); |
| 69 | |
| 70 | #endif /* SCM_THREADS_PLUGIN_H */ |
| 71 | |
| 72 | /* |
| 73 | Local Variables: |
| 74 | c-file-style: "gnu" |
| 75 | End: |
| 76 | */ |