3 |
#ifndef SCM_COOP_DEFS_H |
#ifndef SCM_COOP_DEFS_H |
4 |
#define SCM_COOP_DEFS_H |
#define SCM_COOP_DEFS_H |
5 |
|
|
6 |
/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. |
/* Copyright (C) 1996,1997,1998,1999,2000,2001, 2002 Free Software Foundation, Inc. |
7 |
* |
* |
8 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
142 |
|
|
143 |
typedef struct coop_m { |
typedef struct coop_m { |
144 |
coop_t *owner; /* Mutex owner */ |
coop_t *owner; /* Mutex owner */ |
145 |
|
int level; /* for recursive locks. */ |
146 |
coop_q_t waiting; /* Queue of waiting threads */ |
coop_q_t waiting; /* Queue of waiting threads */ |
147 |
} coop_m; |
} coop_m; |
148 |
|
|
149 |
typedef int coop_mattr; |
typedef int coop_mattr; |
150 |
|
|
|
typedef coop_m scm_t_mutex; |
|
|
|
|
151 |
SCM_API int coop_mutex_init (coop_m*); |
SCM_API int coop_mutex_init (coop_m*); |
152 |
SCM_API int coop_new_mutex_init (coop_m*, coop_mattr*); |
SCM_API int coop_new_mutex_init (coop_m*, coop_mattr*); |
153 |
SCM_API int coop_mutex_lock (coop_m*); |
SCM_API int coop_mutex_lock (coop_m*); |
154 |
SCM_API int coop_mutex_trylock (coop_m*); |
SCM_API int coop_mutex_trylock (coop_m*); |
155 |
SCM_API int coop_mutex_unlock (coop_m*); |
SCM_API int coop_mutex_unlock (coop_m*); |
156 |
SCM_API int coop_mutex_destroy (coop_m*); |
SCM_API int coop_mutex_destroy (coop_m*); |
|
#define scm_mutex_init coop_mutex_init |
|
|
#define scm_mutex_lock coop_mutex_lock |
|
|
#define scm_mutex_trylock coop_mutex_lock |
|
|
#define scm_mutex_unlock coop_mutex_unlock |
|
|
#define scm_mutex_destroy coop_mutex_destroy |
|
157 |
|
|
158 |
/* A Condition variable is made up of a list of threads waiting on the |
/* A Condition variable is made up of a list of threads waiting on the |
159 |
condition. */ |
condition. */ |
164 |
|
|
165 |
typedef int coop_cattr; |
typedef int coop_cattr; |
166 |
|
|
|
typedef coop_c scm_t_cond; |
|
|
|
|
|
#ifndef HAVE_STRUCT_TIMESPEC |
|
|
/* POSIX.4 structure for a time value. This is like a `struct timeval' but |
|
|
has nanoseconds instead of microseconds. */ |
|
|
struct timespec |
|
|
{ |
|
|
long int tv_sec; /* Seconds. */ |
|
|
long int tv_nsec; /* Nanoseconds. */ |
|
|
}; |
|
|
#endif |
|
|
|
|
167 |
SCM_API int coop_condition_variable_init (coop_c*); |
SCM_API int coop_condition_variable_init (coop_c*); |
168 |
SCM_API int coop_new_condition_variable_init (coop_c*, coop_cattr*); |
SCM_API int coop_new_condition_variable_init (coop_c*, coop_cattr*); |
169 |
SCM_API int coop_condition_variable_wait_mutex (coop_c*, coop_m*); |
SCM_API int coop_condition_variable_wait_mutex (coop_c*, coop_m*); |
171 |
coop_m*, |
coop_m*, |
172 |
const struct timespec *abstime); |
const struct timespec *abstime); |
173 |
SCM_API int coop_condition_variable_signal (coop_c*); |
SCM_API int coop_condition_variable_signal (coop_c*); |
174 |
|
SCM_API int coop_condition_variable_broadcast (coop_c*); |
175 |
SCM_API int coop_condition_variable_destroy (coop_c*); |
SCM_API int coop_condition_variable_destroy (coop_c*); |
|
#define scm_cond_init coop_new_condition_variable_init |
|
|
#define scm_cond_wait coop_condition_variable_wait_mutex |
|
|
#define scm_cond_timedwait coop_condition_variable_timed_wait_mutex |
|
|
#define scm_cond_signal coop_condition_variable_signal |
|
|
#define scm_cond_broadcast coop_condition_variable_signal /* yes */ |
|
|
#define scm_cond_destroy coop_condition_variable_destroy |
|
176 |
|
|
177 |
typedef int coop_k; |
typedef int coop_k; |
178 |
|
|