No empty .Rs/.Re
[netbsd-mini2440.git] / external / bsd / openldap / dist / libraries / libldap_r / ldap_thr_debug.h
blobaa9fa3b94095c5883a96ed3091e0b4b419b5d045
1 /* ldap_thr_debug.h - preprocessor magic for LDAP_THREAD_DEBUG */
2 /* $OpenLDAP: pkg/ldap/libraries/libldap_r/ldap_thr_debug.h,v 1.3.2.5 2008/02/11 23:26:41 kurt Exp $ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2005-2008 The OpenLDAP Foundation.
6 * All rights reserved.
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.
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>.
17 #ifdef LDAP_THREAD_DEBUG
20 * libldap_r .c files should include this file after ldap_pvt_thread.h,
21 * with the appropriate LDAP_THREAD*_IMPLEMENTATION macro(s) defined.
24 #ifndef _LDAP_PVT_THREAD_H
25 #error "ldap_pvt_thread.h" must be included before "ldap_thr_debug.h"
26 #endif
29 * Support for thr_debug.c:
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_*.
35 * Implementation:
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.
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.
52 * So,
53 * libldap_r/<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.
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_destroy ldap_int_thread_mutex_destroy
87 #define ldap_pvt_thread_mutex_lock ldap_int_thread_mutex_lock
88 #define ldap_pvt_thread_mutex_trylock ldap_int_thread_mutex_trylock
89 #define ldap_pvt_thread_mutex_unlock ldap_int_thread_mutex_unlock
90 #define ldap_pvt_thread_self ldap_int_thread_self
91 #endif /* LDAP_THREAD_IMPLEMENTATION */
93 #ifdef LDAP_THREAD_RDWR_IMPLEMENTATION /* rdwr.c, thr_debug.c */
94 #ifdef LDAP_THREAD_DEBUG_WRAP /* see ldap_pvt_thread.h */
95 #define ldap_pvt_thread_rdwr_t ldap_int_thread_rdwr_t
96 #endif
97 #define ldap_pvt_thread_rdwr_init ldap_int_thread_rdwr_init
98 #define ldap_pvt_thread_rdwr_destroy ldap_int_thread_rdwr_destroy
99 #define ldap_pvt_thread_rdwr_rlock ldap_int_thread_rdwr_rlock
100 #define ldap_pvt_thread_rdwr_rtrylock ldap_int_thread_rdwr_rtrylock
101 #define ldap_pvt_thread_rdwr_runlock ldap_int_thread_rdwr_runlock
102 #define ldap_pvt_thread_rdwr_wlock ldap_int_thread_rdwr_wlock
103 #define ldap_pvt_thread_rdwr_wtrylock ldap_int_thread_rdwr_wtrylock
104 #define ldap_pvt_thread_rdwr_wunlock ldap_int_thread_rdwr_wunlock
105 #define ldap_pvt_thread_rdwr_readers ldap_int_thread_rdwr_readers
106 #define ldap_pvt_thread_rdwr_writers ldap_int_thread_rdwr_writers
107 #define ldap_pvt_thread_rdwr_active ldap_int_thread_rdwr_active
108 #endif /* LDAP_THREAD_RDWR_IMPLEMENTATION */
110 #ifdef LDAP_THREAD_POOL_IMPLEMENTATION /* tpool.c, thr_stub.c, thr_debug.c */
111 #ifdef LDAP_THREAD_DEBUG_WRAP /* see ldap_pvt_thread.h */
112 #define ldap_pvt_thread_pool_t ldap_int_thread_pool_t
113 #endif
114 #define ldap_pvt_thread_pool_init ldap_int_thread_pool_init
115 #define ldap_pvt_thread_pool_submit ldap_int_thread_pool_submit
116 #define ldap_pvt_thread_pool_maxthreads ldap_int_thread_pool_maxthreads
117 #define ldap_pvt_thread_pool_backload ldap_int_thread_pool_backload
118 #define ldap_pvt_thread_pool_pause ldap_int_thread_pool_pause
119 #define ldap_pvt_thread_pool_resume ldap_int_thread_pool_resume
120 #define ldap_pvt_thread_pool_destroy ldap_int_thread_pool_destroy
121 #define ldap_pvt_thread_pool_getkey ldap_int_thread_pool_getkey
122 #define ldap_pvt_thread_pool_setkey ldap_int_thread_pool_setkey
123 #define ldap_pvt_thread_pool_purgekey ldap_int_thread_pool_purgekey
124 #define ldap_pvt_thread_pool_context ldap_int_thread_pool_context
125 #define ldap_pvt_thread_pool_context_reset ldap_int_thread_pool_context_reset
126 #endif /* LDAP_THREAD_POOL_IMPLEMENTATION */
128 #undef _LDAP_PVT_THREAD_H
129 #include "ldap_pvt_thread.h"
131 #ifdef LDAP_THREAD_POOL_IMPLEMENTATION /* tpool.c */
133 * tpool.c:ldap_int_thread_pool_shutdown() needs this. Could not
134 * use it for ldap_pvt_thread.h above because of its use of LDAP_P().
136 #undef ldap_pvt_thread_pool_destroy
137 #define ldap_pvt_thread_pool_destroy(p,r) ldap_int_thread_pool_destroy(p,r)
138 #endif
140 #ifdef LDAP_THREAD_DEBUG_IMPLEMENTATION /* thr_debug.c */
141 #undef ldap_pvt_thread_mutex_t
142 #undef ldap_pvt_thread_cond_t
143 #undef ldap_pvt_thread_sleep
144 #undef ldap_pvt_thread_get_concurrency
145 #undef ldap_pvt_thread_set_concurrency
146 #undef ldap_pvt_thread_create
147 #undef ldap_pvt_thread_exit
148 #undef ldap_pvt_thread_join
149 #undef ldap_pvt_thread_kill
150 #undef ldap_pvt_thread_yield
151 #undef ldap_pvt_thread_cond_init
152 #undef ldap_pvt_thread_cond_destroy
153 #undef ldap_pvt_thread_cond_signal
154 #undef ldap_pvt_thread_cond_broadcast
155 #undef ldap_pvt_thread_cond_wait
156 #undef ldap_pvt_thread_mutex_init
157 #undef ldap_pvt_thread_mutex_destroy
158 #undef ldap_pvt_thread_mutex_lock
159 #undef ldap_pvt_thread_mutex_trylock
160 #undef ldap_pvt_thread_mutex_unlock
161 #undef ldap_pvt_thread_self
162 /* LDAP_THREAD_RDWR_IMPLEMENTATION: */
163 #undef ldap_pvt_thread_rdwr_t
164 #undef ldap_pvt_thread_rdwr_init
165 #undef ldap_pvt_thread_rdwr_destroy
166 #undef ldap_pvt_thread_rdwr_rlock
167 #undef ldap_pvt_thread_rdwr_rtrylock
168 #undef ldap_pvt_thread_rdwr_runlock
169 #undef ldap_pvt_thread_rdwr_wlock
170 #undef ldap_pvt_thread_rdwr_wtrylock
171 #undef ldap_pvt_thread_rdwr_wunlock
172 #undef ldap_pvt_thread_rdwr_readers
173 #undef ldap_pvt_thread_rdwr_writers
174 #undef ldap_pvt_thread_rdwr_active
175 /* LDAP_THREAD_POOL_IMPLEMENTATION: */
176 #undef ldap_pvt_thread_pool_t
177 #undef ldap_pvt_thread_pool_init
178 #undef ldap_pvt_thread_pool_submit
179 #undef ldap_pvt_thread_pool_maxthreads
180 #undef ldap_pvt_thread_pool_backload
181 #undef ldap_pvt_thread_pool_pause
182 #undef ldap_pvt_thread_pool_resume
183 #undef ldap_pvt_thread_pool_destroy
184 #undef ldap_pvt_thread_pool_getkey
185 #undef ldap_pvt_thread_pool_setkey
186 #undef ldap_pvt_thread_pool_purgekey
187 #undef ldap_pvt_thread_pool_context
188 #undef ldap_pvt_thread_pool_context_reset
189 #endif /* LDAP_THREAD_DEBUG_IMPLEMENTATION */
191 #endif /* LDAP_THREAD_DEBUG */