3 * Copyright 1998-2001 The OpenLDAP Foundation, Redwood City, California, USA
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted only as authorized by the OpenLDAP
8 * Public License. A copy of this license is available at
9 * http://www.OpenLDAP.org/license.html or in file LICENSE in the
10 * top-level directory of the distribution.
12 /* ldap_pvt_thread.h - ldap threads header file NG */
14 #ifndef _LDAP_PVT_THREAD_H
15 #define _LDAP_PVT_THREAD_H
17 #include "ldap_cdefs.h"
18 #include "ldap_int_thread.h"
22 typedef ldap_int_thread_t ldap_pvt_thread_t;
23 typedef ldap_int_thread_mutex_t ldap_pvt_thread_mutex_t;
24 typedef ldap_int_thread_cond_t ldap_pvt_thread_cond_t;
27 ldap_pvt_thread_initialize LDAP_P(( void ));
30 ldap_pvt_thread_destroy LDAP_P(( void ));
32 LDAP_F( unsigned int )
33 ldap_pvt_thread_sleep LDAP_P(( unsigned int s ));
36 ldap_pvt_thread_get_concurrency LDAP_P(( void ));
39 ldap_pvt_thread_set_concurrency LDAP_P(( int ));
41 #define LDAP_PVT_THREAD_CREATE_JOINABLE 0
42 #define LDAP_PVT_THREAD_CREATE_DETACHED 1
45 ldap_pvt_thread_create LDAP_P((
46 ldap_pvt_thread_t * thread,
48 void *(*start_routine)( void * ),
52 ldap_pvt_thread_exit LDAP_P(( void *retval ));
55 ldap_pvt_thread_join LDAP_P(( ldap_pvt_thread_t thread, void **status ));
58 ldap_pvt_thread_kill LDAP_P(( ldap_pvt_thread_t thread, int signo ));
61 ldap_pvt_thread_yield LDAP_P(( void ));
64 ldap_pvt_thread_cond_init LDAP_P(( ldap_pvt_thread_cond_t *cond ));
67 ldap_pvt_thread_cond_destroy LDAP_P(( ldap_pvt_thread_cond_t *cond ));
70 ldap_pvt_thread_cond_signal LDAP_P(( ldap_pvt_thread_cond_t *cond ));
73 ldap_pvt_thread_cond_broadcast LDAP_P(( ldap_pvt_thread_cond_t *cond ));
76 ldap_pvt_thread_cond_wait LDAP_P((
77 ldap_pvt_thread_cond_t *cond,
78 ldap_pvt_thread_mutex_t *mutex ));
81 ldap_pvt_thread_mutex_init LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
84 ldap_pvt_thread_mutex_destroy LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
87 ldap_pvt_thread_mutex_lock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
90 ldap_pvt_thread_mutex_trylock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
93 ldap_pvt_thread_mutex_unlock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
95 #ifndef LDAP_THREAD_HAVE_RDWR
96 typedef struct ldap_int_thread_rdwr_s * ldap_pvt_thread_rdwr_t;
100 ldap_pvt_thread_rdwr_init LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
103 ldap_pvt_thread_rdwr_destroy LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
106 ldap_pvt_thread_rdwr_rlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
109 ldap_pvt_thread_rdwr_rtrylock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
112 ldap_pvt_thread_rdwr_runlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
115 ldap_pvt_thread_rdwr_wlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
118 ldap_pvt_thread_rdwr_wtrylock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
121 ldap_pvt_thread_rdwr_wunlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
125 ldap_pvt_thread_rdwr_readers LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
128 ldap_pvt_thread_rdwr_writers LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
131 ldap_pvt_thread_rdwr_active LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
132 #endif /* LDAP_DEBUG */
134 #define LDAP_PVT_THREAD_EINVAL EINVAL
135 #define LDAP_PVT_THREAD_EBUSY EINVAL
137 typedef ldap_int_thread_pool_t ldap_pvt_thread_pool_t;
140 ldap_pvt_thread_pool_init LDAP_P((
141 ldap_pvt_thread_pool_t *pool_out,
146 ldap_pvt_thread_pool_submit LDAP_P((
147 ldap_pvt_thread_pool_t *pool,
148 void *(*start_routine)( void * ),
152 ldap_pvt_thread_pool_maxthreads LDAP_P((
153 ldap_pvt_thread_pool_t *pool,
157 ldap_pvt_thread_pool_backload LDAP_P((
158 ldap_pvt_thread_pool_t *pool ));
161 ldap_pvt_thread_pool_destroy LDAP_P((
162 ldap_pvt_thread_pool_t *pool,
168 #endif /* _LDAP_THREAD_H */