25 #if !defined(GLOBUS_THREAD_H)
26 #define GLOBUS_THREAD_H 1
32 #if !defined(_WIN32) || defined(__MINGW32__)
37 #if !defined(HAVE_PTHREAD)
38 #define HAVE_PTHREAD 1
40 #if defined __GNUC__ && defined __EXCEPTIONS
43 #define __EXCEPTIONS 1
51 #define HAVE_WINDOWS_THREADS 1
63 #define GLOBUS_THREAD_MODEL_NONE "none"
64 #define GLOBUS_THREAD_MODEL_PTHREADS "pthread"
65 #define GLOBUS_THREAD_MODEL_WINDOWS "windows"
77 #if HAVE_WINDOWS_THREADS
92 pthread_attr_t pthread;
94 #if HAVE_WINDOWS_THREADS
101 typedef void * (*globus_thread_func_t)(
void *);
111 pthread_mutex_t pthread;
113 #if HAVE_WINDOWS_THREADS
128 struct globus_cond_pthread_s
135 #if HAVE_WINDOWS_THREADS
136 struct globus_cond_windows_s
155 pthread_mutexattr_t pthread;
157 #if HAVE_WINDOWS_THREADS
158 struct globus_mutexattr_windows_s
160 LPSECURITY_ATTRIBUTES securityAttributes;
175 struct globus_condattr_pthread_s
177 pthread_condattr_t attr;
181 #if HAVE_WINDOWS_THREADS
182 struct globus_condattr_windows_s
184 LPSECURITY_ATTRIBUTES securityAttributes;
205 pthread_key_t pthread;
207 #if HAVE_WINDOWS_THREADS
208 struct globus_thread_key_windows_s
230 pthread_once_t pthread;
232 #if HAVE_WINDOWS_THREADS
247 # define GLOBUS_THREAD_ONCE_INIT { .pthread = PTHREAD_ONCE_INIT }
248 #elif HAVE_WINDOWS_THREADS
249 # define GLOBUS_THREAD_ONCE_INIT { .windows = 0 }
251 # define GLOBUS_THREAD_ONCE_INIT { .none = 0 }
307 globus_abstime_t * abstime);
346 globus_thread_func_t func,
375 void (*init_routine)(
void));
385 const sigset_t * newmask,
419 void * (*func)(
void *),
421 void (*cleanup_func)(
void *),
444 #define GLOBUS_THREAD_CANCEL_DISABLE 0
450 #define GLOBUS_THREAD_CANCEL_ENABLE 1
455 globus_i_thread_pre_activate();
465 #define GLOBUS_THREAD_MODULE (&globus_i_thread_module)
492 void (*thread_yield)(void);
493 void (*thread_exit)(
void *value);
494 int (*thread_sigmask)(
int how,
const sigset_t *newmask, sigset_t *oldmask);
496 int (*thread_setcancelstate)(
int state,
int *oldstate);
497 void (*thread_testcancel)(void);
503 void * (*thread_cancellable_func)(
504 void * (*func)(
void *),
void *func_arg,
void (*cleanup_func)(
void *),
void * cleanup_arg,
globus_bool_t execute_cleanup);
505 int (*thread_pre_activate)(void);
507 globus_thread_impl_t;