3 * Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA
6 * Redistribution and use in source and binary forms are permitted only
7 * as authorized by the OpenLDAP Public License. A copy of this
8 * license is available at http://www.OpenLDAP.org/license.html or
9 * in file LICENSE in the top-level directory of the distribution.
11 /* ldap_pvt_thread.h - ldap threads header file NG */
13 #ifndef _LDAP_PVT_THREAD_H
14 #define _LDAP_PVT_THREAD_H
16 #include "ldap_cdefs.h"
17 #include "ldap_int_thread.h"
21 typedef ldap_int_thread_t ldap_pvt_thread_t;
22 typedef ldap_int_thread_mutex_t ldap_pvt_thread_mutex_t;
23 typedef ldap_int_thread_cond_t ldap_pvt_thread_cond_t;
26 ldap_pvt_thread_initialize LDAP_P(( void ));
29 ldap_pvt_thread_destroy LDAP_P(( void ));
31 LDAP_F( unsigned int )
32 ldap_pvt_thread_sleep LDAP_P(( unsigned int s ));
35 ldap_pvt_thread_get_concurrency LDAP_P(( void ));
38 ldap_pvt_thread_set_concurrency LDAP_P(( int ));
40 #define LDAP_PVT_THREAD_CREATE_JOINABLE 0
41 #define LDAP_PVT_THREAD_CREATE_DETACHED 1
44 ldap_pvt_thread_create LDAP_P((
45 ldap_pvt_thread_t * thread,
47 void *(*start_routine)( void * ),
51 ldap_pvt_thread_exit LDAP_P(( void *retval ));
54 ldap_pvt_thread_join LDAP_P(( ldap_pvt_thread_t thread, void **status ));
57 ldap_pvt_thread_kill LDAP_P(( ldap_pvt_thread_t thread, int signo ));
60 ldap_pvt_thread_yield LDAP_P(( void ));
63 ldap_pvt_thread_cond_init LDAP_P(( ldap_pvt_thread_cond_t *cond ));
66 ldap_pvt_thread_cond_destroy LDAP_P(( ldap_pvt_thread_cond_t *cond ));
69 ldap_pvt_thread_cond_signal LDAP_P(( ldap_pvt_thread_cond_t *cond ));
72 ldap_pvt_thread_cond_broadcast LDAP_P(( ldap_pvt_thread_cond_t *cond ));
75 ldap_pvt_thread_cond_wait LDAP_P((
76 ldap_pvt_thread_cond_t *cond,
77 ldap_pvt_thread_mutex_t *mutex ));
80 ldap_pvt_thread_mutex_init LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
83 ldap_pvt_thread_mutex_destroy LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
86 ldap_pvt_thread_mutex_lock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
89 ldap_pvt_thread_mutex_trylock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
92 ldap_pvt_thread_mutex_unlock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
94 #ifndef LDAP_THREAD_HAVE_RDWR
95 typedef struct ldap_int_thread_rdwr_s * ldap_pvt_thread_rdwr_t;
99 ldap_pvt_thread_rdwr_init LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
102 ldap_pvt_thread_rdwr_destroy LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
105 ldap_pvt_thread_rdwr_rlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
108 ldap_pvt_thread_rdwr_rtrylock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
111 ldap_pvt_thread_rdwr_runlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
114 ldap_pvt_thread_rdwr_wlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
117 ldap_pvt_thread_rdwr_wtrylock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
120 ldap_pvt_thread_rdwr_wunlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
124 ldap_pvt_thread_rdwr_readers LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
127 ldap_pvt_thread_rdwr_writers LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
130 ldap_pvt_thread_rdwr_active LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
131 #endif /* LDAP_DEBUG */
133 #define LDAP_PVT_THREAD_EINVAL EINVAL
134 #define LDAP_PVT_THREAD_EBUSY EINVAL
136 typedef ldap_int_thread_pool_t ldap_pvt_thread_pool_t;
139 ldap_pvt_thread_pool_init LDAP_P((
140 ldap_pvt_thread_pool_t *pool_out,
145 ldap_pvt_thread_pool_submit LDAP_P((
146 ldap_pvt_thread_pool_t *pool,
147 void *(*start_routine)( void * ),
151 ldap_pvt_thread_pool_maxthreads LDAP_P((
152 ldap_pvt_thread_pool_t *pool,
156 ldap_pvt_thread_pool_backload LDAP_P((
157 ldap_pvt_thread_pool_t *pool ));
160 ldap_pvt_thread_pool_destroy LDAP_P((
161 ldap_pvt_thread_pool_t *pool,
167 #endif /* _LDAP_THREAD_H */