]> git.sur5r.net Git - openldap/blob - include/ldap_pvt_thread.h
Add an LDBM backend "directory" directive (in addition to
[openldap] / include / ldap_pvt_thread.h
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA
4  * All rights reserved.
5  *
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.
10  */
11 /* ldap_pvt_thread.h - ldap threads header file NG */
12
13 #ifndef _LDAP_PVT_THREAD_H
14 #define _LDAP_PVT_THREAD_H
15
16 #include "ldap_cdefs.h"
17 #include "ldap_int_thread.h"
18
19 LDAP_BEGIN_DECL
20
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;
24
25 LDAP_F( int )
26 ldap_pvt_thread_initialize LDAP_P(( void ));
27
28 LDAP_F( int )
29 ldap_pvt_thread_destroy LDAP_P(( void ));
30
31 LDAP_F( unsigned int )
32 ldap_pvt_thread_sleep LDAP_P(( unsigned int s ));
33
34 LDAP_F( int )
35 ldap_pvt_thread_get_concurrency LDAP_P(( void ));
36
37 LDAP_F( int )
38 ldap_pvt_thread_set_concurrency LDAP_P(( int ));
39
40 #define LDAP_PVT_THREAD_CREATE_JOINABLE 0
41 #define LDAP_PVT_THREAD_CREATE_DETACHED 1
42
43 LDAP_F( int ) 
44 ldap_pvt_thread_create LDAP_P((
45         ldap_pvt_thread_t * thread, 
46         int     detach,
47         void *(*start_routine)( void * ), 
48         void *arg));
49
50 LDAP_F( void ) 
51 ldap_pvt_thread_exit LDAP_P(( void *retval ));
52
53 LDAP_F( int )
54 ldap_pvt_thread_join LDAP_P(( ldap_pvt_thread_t thread, void **status ));
55
56 LDAP_F( int )
57 ldap_pvt_thread_kill LDAP_P(( ldap_pvt_thread_t thread, int signo ));
58
59 LDAP_F( int )
60 ldap_pvt_thread_yield LDAP_P(( void ));
61
62 LDAP_F( int )
63 ldap_pvt_thread_cond_init LDAP_P(( ldap_pvt_thread_cond_t *cond ));
64
65 LDAP_F( int )
66 ldap_pvt_thread_cond_destroy LDAP_P(( ldap_pvt_thread_cond_t *cond ));
67
68 LDAP_F( int )
69 ldap_pvt_thread_cond_signal LDAP_P(( ldap_pvt_thread_cond_t *cond ));
70
71 LDAP_F( int )
72 ldap_pvt_thread_cond_broadcast LDAP_P(( ldap_pvt_thread_cond_t *cond ));
73
74 LDAP_F( int )
75 ldap_pvt_thread_cond_wait LDAP_P((
76         ldap_pvt_thread_cond_t *cond, 
77         ldap_pvt_thread_mutex_t *mutex ));
78
79 LDAP_F( int )
80 ldap_pvt_thread_mutex_init LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
81
82 LDAP_F( int )
83 ldap_pvt_thread_mutex_destroy LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
84
85 LDAP_F( int )
86 ldap_pvt_thread_mutex_lock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
87
88 LDAP_F( int )
89 ldap_pvt_thread_mutex_trylock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
90
91 LDAP_F( int )
92 ldap_pvt_thread_mutex_unlock LDAP_P(( ldap_pvt_thread_mutex_t *mutex ));
93
94 #ifndef LDAP_THREAD_HAVE_RDWR
95 typedef struct ldap_int_thread_rdwr_s * ldap_pvt_thread_rdwr_t;
96 #endif
97
98 LDAP_F( int )
99 ldap_pvt_thread_rdwr_init LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
100
101 LDAP_F( int )
102 ldap_pvt_thread_rdwr_destroy LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
103
104 LDAP_F( int )
105 ldap_pvt_thread_rdwr_rlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
106
107 LDAP_F( int )
108 ldap_pvt_thread_rdwr_rtrylock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
109
110 LDAP_F( int )
111 ldap_pvt_thread_rdwr_runlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
112
113 LDAP_F( int )
114 ldap_pvt_thread_rdwr_wlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
115
116 LDAP_F( int )
117 ldap_pvt_thread_rdwr_wtrylock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
118
119 LDAP_F( int )
120 ldap_pvt_thread_rdwr_wunlock LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
121
122 #ifdef LDAP_DEBUG
123 LDAP_F( int )
124 ldap_pvt_thread_rdwr_readers LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
125
126 LDAP_F( int )
127 ldap_pvt_thread_rdwr_writers LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
128
129 LDAP_F( int )
130 ldap_pvt_thread_rdwr_active LDAP_P((ldap_pvt_thread_rdwr_t *rdwrp));
131 #endif /* LDAP_DEBUG */
132
133 #define LDAP_PVT_THREAD_EINVAL EINVAL
134 #define LDAP_PVT_THREAD_EBUSY EINVAL
135
136 typedef ldap_int_thread_pool_t ldap_pvt_thread_pool_t;
137
138 LDAP_F( int )
139 ldap_pvt_thread_pool_init LDAP_P((
140         ldap_pvt_thread_pool_t *pool_out,
141         int max_threads,
142         int max_pending ));
143
144 LDAP_F( int )
145 ldap_pvt_thread_pool_submit LDAP_P((
146         ldap_pvt_thread_pool_t *pool,
147         void *(*start_routine)( void * ),
148         void *arg ));
149
150 LDAP_F( int )
151 ldap_pvt_thread_pool_maxthreads LDAP_P((
152         ldap_pvt_thread_pool_t *pool,
153         int max_threads ));
154
155 LDAP_F( int )
156 ldap_pvt_thread_pool_backload LDAP_P((
157         ldap_pvt_thread_pool_t *pool ));
158
159 LDAP_F( int )
160 ldap_pvt_thread_pool_destroy LDAP_P((
161         ldap_pvt_thread_pool_t *pool,
162         int run_pending ));
163
164
165 LDAP_END_DECL
166
167 #endif /* _LDAP_THREAD_H */