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