Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/libs/ldap/libldap/ldap_thr_debug.h
4393 views
1
/* ldap_thr_debug.h - preprocessor magic for LDAP_THREAD_DEBUG */
2
/* $OpenLDAP$ */
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
*
5
* Copyright 2005-2024 The OpenLDAP Foundation.
6
* All rights reserved.
7
*
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted only as authorized by the OpenLDAP
10
* Public License.
11
*
12
* A copy of this license is available in the file LICENSE in the
13
* top-level directory of the distribution or, alternatively, at
14
* <http://www.OpenLDAP.org/license.html>.
15
*/
16
17
#ifdef LDAP_THREAD_DEBUG
18
19
/*
20
* libldap .c files should include this file after ldap_pvt_thread.h,
21
* with the appropriate LDAP_THREAD*_IMPLEMENTATION macro(s) defined.
22
*/
23
24
#ifndef _LDAP_PVT_THREAD_H
25
#error "ldap_pvt_thread.h" must be included before "ldap_thr_debug.h"
26
#endif
27
28
/*
29
* Support for thr_debug.c:
30
*
31
* thr_debug.c defines ldap_pvt_thread_* as wrappers around the real
32
* ldap_pvt_thread_* implementation, which this file renames to
33
* ldap_int_thread_*.
34
*
35
* Implementation:
36
*
37
* This file re#defines selected ldap_pvt_thread_* names to
38
* ldap_int_thread_*, which will be used from wrappers in thr_debug.c.
39
* Two ldap_int_*() calls are redirected to call ldap_debug_*(): These
40
* are wrappers around the originals, whose definitions are not renamed.
41
* This file then #includes ldap_pvt_thread.h to declare the renamed
42
* functions/types. If #included from thr_debug.c it finally #undefines
43
* the macros again.
44
*
45
* include/ldap_pvt_thread.h declares the typedefs ldap_pvt_thread*_t as
46
* either wrapper types ldap_debug_thread*_t or their usual definitions
47
* ldap_int_thread*_t, depending on the LDAP_THREAD_DEBUG_WRAP option.
48
* When defining the underlying implementation, this file then redirects
49
* the type names back to the original ldap_int_thread*_t types.
50
* include/ldap_<int,pvt>_thread.h also do some thr_debug magic.
51
*
52
* So,
53
* libldap/<not thr_debug.c> thus define ldap_int_thread_*() instead
54
* of ldap_pvt_thread_*().
55
* thr_debug.c defines the ldap_pvt_*() and ldap_debug_*() functions.
56
* In thread.c, ldap_pvt_thread_<initialize/destroy>() will call
57
* ldap_debug_thread_*() instead of ldap_int_thread_*().
58
* In tpool.c, ldap_int_thread_pool_shutdown() has explicit thr_debug.c
59
* support which treats ldap_pvt_thread_pool_destroy() the same way.
60
*/
61
62
#ifndef LDAP_THREAD_IMPLEMENTATION /* for first part of threads.c */
63
#define ldap_int_thread_initialize ldap_debug_thread_initialize
64
#define ldap_int_thread_destroy ldap_debug_thread_destroy
65
#else /* LDAP_THREAD_IMPLEMENTATION -- for thr_*.c and end of threads.c */
66
#undef ldap_int_thread_initialize
67
#undef ldap_int_thread_destroy
68
#ifdef LDAP_THREAD_DEBUG_WRAP /* see ldap_pvt_thread.h */
69
#define ldap_pvt_thread_mutex_t ldap_int_thread_mutex_t
70
#define ldap_pvt_thread_cond_t ldap_int_thread_cond_t
71
#endif
72
#define ldap_pvt_thread_sleep ldap_int_thread_sleep
73
#define ldap_pvt_thread_get_concurrency ldap_int_thread_get_concurrency
74
#define ldap_pvt_thread_set_concurrency ldap_int_thread_set_concurrency
75
#define ldap_pvt_thread_create ldap_int_thread_create
76
#define ldap_pvt_thread_exit ldap_int_thread_exit
77
#define ldap_pvt_thread_join ldap_int_thread_join
78
#define ldap_pvt_thread_kill ldap_int_thread_kill
79
#define ldap_pvt_thread_yield ldap_int_thread_yield
80
#define ldap_pvt_thread_cond_init ldap_int_thread_cond_init
81
#define ldap_pvt_thread_cond_destroy ldap_int_thread_cond_destroy
82
#define ldap_pvt_thread_cond_signal ldap_int_thread_cond_signal
83
#define ldap_pvt_thread_cond_broadcast ldap_int_thread_cond_broadcast
84
#define ldap_pvt_thread_cond_wait ldap_int_thread_cond_wait
85
#define ldap_pvt_thread_mutex_init ldap_int_thread_mutex_init
86
#define ldap_pvt_thread_mutex_recursive_init ldap_int_thread_mutex_recursive_init
87
#define ldap_pvt_thread_mutex_destroy ldap_int_thread_mutex_destroy
88
#define ldap_pvt_thread_mutex_lock ldap_int_thread_mutex_lock
89
#define ldap_pvt_thread_mutex_trylock ldap_int_thread_mutex_trylock
90
#define ldap_pvt_thread_mutex_unlock ldap_int_thread_mutex_unlock
91
#define ldap_pvt_thread_self ldap_int_thread_self
92
#endif /* LDAP_THREAD_IMPLEMENTATION */
93
94
#ifdef LDAP_THREAD_RDWR_IMPLEMENTATION /* rdwr.c, thr_debug.c */
95
#ifdef LDAP_THREAD_DEBUG_WRAP /* see ldap_pvt_thread.h */
96
#define ldap_pvt_thread_rdwr_t ldap_int_thread_rdwr_t
97
#endif
98
#define ldap_pvt_thread_rdwr_init ldap_int_thread_rdwr_init
99
#define ldap_pvt_thread_rdwr_destroy ldap_int_thread_rdwr_destroy
100
#define ldap_pvt_thread_rdwr_rlock ldap_int_thread_rdwr_rlock
101
#define ldap_pvt_thread_rdwr_rtrylock ldap_int_thread_rdwr_rtrylock
102
#define ldap_pvt_thread_rdwr_runlock ldap_int_thread_rdwr_runlock
103
#define ldap_pvt_thread_rdwr_wlock ldap_int_thread_rdwr_wlock
104
#define ldap_pvt_thread_rdwr_wtrylock ldap_int_thread_rdwr_wtrylock
105
#define ldap_pvt_thread_rdwr_wunlock ldap_int_thread_rdwr_wunlock
106
#define ldap_pvt_thread_rdwr_readers ldap_int_thread_rdwr_readers
107
#define ldap_pvt_thread_rdwr_writers ldap_int_thread_rdwr_writers
108
#define ldap_pvt_thread_rdwr_active ldap_int_thread_rdwr_active
109
#endif /* LDAP_THREAD_RDWR_IMPLEMENTATION */
110
111
#ifdef LDAP_THREAD_POOL_IMPLEMENTATION /* tpool.c, thr_debug.c */
112
#ifdef LDAP_THREAD_DEBUG_WRAP /* see ldap_pvt_thread.h */
113
#define ldap_pvt_thread_pool_t ldap_int_thread_pool_t
114
#endif
115
#define ldap_pvt_thread_pool_init ldap_int_thread_pool_init
116
#define ldap_pvt_thread_pool_submit ldap_int_thread_pool_submit
117
#define ldap_pvt_thread_pool_maxthreads ldap_int_thread_pool_maxthreads
118
#define ldap_pvt_thread_pool_backload ldap_int_thread_pool_backload
119
#define ldap_pvt_thread_pool_pause ldap_int_thread_pool_pause
120
#define ldap_pvt_thread_pool_resume ldap_int_thread_pool_resume
121
#define ldap_pvt_thread_pool_destroy ldap_int_thread_pool_destroy
122
#define ldap_pvt_thread_pool_close ldap_int_thread_pool_close
123
#define ldap_pvt_thread_pool_free ldap_int_thread_pool_free
124
#define ldap_pvt_thread_pool_getkey ldap_int_thread_pool_getkey
125
#define ldap_pvt_thread_pool_setkey ldap_int_thread_pool_setkey
126
#define ldap_pvt_thread_pool_purgekey ldap_int_thread_pool_purgekey
127
#define ldap_pvt_thread_pool_context ldap_int_thread_pool_context
128
#define ldap_pvt_thread_pool_context_reset ldap_int_thread_pool_context_reset
129
#endif /* LDAP_THREAD_POOL_IMPLEMENTATION */
130
131
#undef _LDAP_PVT_THREAD_H
132
#include "ldap_pvt_thread.h"
133
134
#ifdef LDAP_THREAD_POOL_IMPLEMENTATION /* tpool.c */
135
/*
136
* tpool.c:ldap_int_thread_pool_shutdown() needs this. Could not
137
* use it for ldap_pvt_thread.h above because of its use of LDAP_P().
138
*/
139
#undef ldap_pvt_thread_pool_destroy
140
#define ldap_pvt_thread_pool_destroy(p,r) ldap_int_thread_pool_destroy(p,r)
141
#endif
142
143
#ifdef LDAP_THREAD_DEBUG_IMPLEMENTATION /* thr_debug.c */
144
#undef ldap_pvt_thread_mutex_t
145
#undef ldap_pvt_thread_cond_t
146
#undef ldap_pvt_thread_sleep
147
#undef ldap_pvt_thread_get_concurrency
148
#undef ldap_pvt_thread_set_concurrency
149
#undef ldap_pvt_thread_create
150
#undef ldap_pvt_thread_exit
151
#undef ldap_pvt_thread_join
152
#undef ldap_pvt_thread_kill
153
#undef ldap_pvt_thread_yield
154
#undef ldap_pvt_thread_cond_init
155
#undef ldap_pvt_thread_cond_destroy
156
#undef ldap_pvt_thread_cond_signal
157
#undef ldap_pvt_thread_cond_broadcast
158
#undef ldap_pvt_thread_cond_wait
159
#undef ldap_pvt_thread_mutex_init
160
#undef ldap_pvt_thread_mutex_recursive_init
161
#undef ldap_pvt_thread_mutex_destroy
162
#undef ldap_pvt_thread_mutex_lock
163
#undef ldap_pvt_thread_mutex_trylock
164
#undef ldap_pvt_thread_mutex_unlock
165
#undef ldap_pvt_thread_self
166
/* LDAP_THREAD_RDWR_IMPLEMENTATION: */
167
#undef ldap_pvt_thread_rdwr_t
168
#undef ldap_pvt_thread_rdwr_init
169
#undef ldap_pvt_thread_rdwr_destroy
170
#undef ldap_pvt_thread_rdwr_rlock
171
#undef ldap_pvt_thread_rdwr_rtrylock
172
#undef ldap_pvt_thread_rdwr_runlock
173
#undef ldap_pvt_thread_rdwr_wlock
174
#undef ldap_pvt_thread_rdwr_wtrylock
175
#undef ldap_pvt_thread_rdwr_wunlock
176
#undef ldap_pvt_thread_rdwr_readers
177
#undef ldap_pvt_thread_rdwr_writers
178
#undef ldap_pvt_thread_rdwr_active
179
/* LDAP_THREAD_POOL_IMPLEMENTATION: */
180
#undef ldap_pvt_thread_pool_t
181
#undef ldap_pvt_thread_pool_init
182
#undef ldap_pvt_thread_pool_submit
183
#undef ldap_pvt_thread_pool_maxthreads
184
#undef ldap_pvt_thread_pool_backload
185
#undef ldap_pvt_thread_pool_pause
186
#undef ldap_pvt_thread_pool_resume
187
#undef ldap_pvt_thread_pool_destroy
188
#undef ldap_pvt_thread_pool_close
189
#undef ldap_pvt_thread_pool_free
190
#undef ldap_pvt_thread_pool_getkey
191
#undef ldap_pvt_thread_pool_setkey
192
#undef ldap_pvt_thread_pool_purgekey
193
#undef ldap_pvt_thread_pool_context
194
#undef ldap_pvt_thread_pool_context_reset
195
#endif /* LDAP_THREAD_DEBUG_IMPLEMENTATION */
196
197
#endif /* LDAP_THREAD_DEBUG */
198
199