aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/mhd_locks.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/mhd_locks.h')
-rw-r--r--src/microhttpd/mhd_locks.h47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/microhttpd/mhd_locks.h b/src/microhttpd/mhd_locks.h
index cf10c0d1..1d8376f0 100644
--- a/src/microhttpd/mhd_locks.h
+++ b/src/microhttpd/mhd_locks.h
@@ -22,8 +22,9 @@
22 * @file microhttpd/mhd_locks.h 22 * @file microhttpd/mhd_locks.h
23 * @brief Header for platform-independent locks abstraction 23 * @brief Header for platform-independent locks abstraction
24 * @author Karlson2k (Evgeny Grin) 24 * @author Karlson2k (Evgeny Grin)
25 * @author Christian Grothoff
25 * 26 *
26 * Provides basic abstraction for locks and mutex. 27 * Provides basic abstraction for locks/mutex and semaphores.
27 * Any functions can be implemented as macro on some platforms 28 * Any functions can be implemented as macro on some platforms
28 * unless explicitly marked otherwise. 29 * unless explicitly marked otherwise.
29 * Any function argument can be skipped in macro, so avoid 30 * Any function argument can be skipped in macro, so avoid
@@ -147,4 +148,48 @@
147#define MHD_mutex_unlock_(pmutex) (LeaveCriticalSection((pmutex)), !0) 148#define MHD_mutex_unlock_(pmutex) (LeaveCriticalSection((pmutex)), !0)
148#endif 149#endif
149 150
151
152/**
153 * A semaphore.
154 */
155struct MHD_Semaphore;
156
157
158/**
159 * Create a semaphore with an initial counter of @a init
160 *
161 * @param init initial counter
162 * @return the semaphore, NULL on error
163 */
164struct MHD_Semaphore *
165MHD_semaphore_create (unsigned int init);
166
167
168/**
169 * Count down the semaphore, block if necessary.
170 *
171 * @param sem semaphore to count down.
172 */
173void
174MHD_semaphore_down (struct MHD_Semaphore *sem);
175
176
177/**
178 * Increment the semaphore.
179 *
180 * @param sem semaphore to increment.
181 */
182void
183MHD_semaphore_up (struct MHD_Semaphore *sem);
184
185
186/**
187 * Destroys the semaphore.
188 *
189 * @param sem semaphore to destroy.
190 */
191void
192MHD_semaphore_destroy (struct MHD_Semaphore *sem);
193
194
150#endif /* ! MHD_LOCKS_H */ 195#endif /* ! MHD_LOCKS_H */