Add BIND 9.2.4rc7.
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / isc / nothreads / include / isc / condition.h
blobff2a2f01054cca4a93a8921faf264c5d7c0c5b21
1 /*
2 * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 2000, 2001 Internet Software Consortium.
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: condition.h,v 1.3.2.1 2004/03/09 06:12:05 marka Exp $ */
21 * This provides a limited subset of the isc_condition_t
22 * functionality for use by single-threaded programs that
23 * need to block waiting for events. Only a single
24 * call to isc_condition_wait() may be blocked at any given
25 * time, and the _waituntil and _broadcast functions are not
26 * supported. This is intended primarily for use by the omapi
27 * library, and may go away once omapi goes away. Use for
28 * other purposes is strongly discouraged.
31 #ifndef ISC_CONDITION_H
32 #define ISC_CONDITION_H 1
34 #include <isc/mutex.h>
36 typedef int isc_condition_t;
38 isc_result_t isc__nothread_wait_hack(isc_condition_t *cp, isc_mutex_t *mp);
39 isc_result_t isc__nothread_signal_hack(isc_condition_t *cp);
41 #define isc_condition_init(cp) \
42 (*(cp) = 0, ISC_R_SUCCESS)
44 #define isc_condition_wait(cp, mp) \
45 isc__nothread_wait_hack(cp, mp)
47 #define isc_condition_waituntil(cp, mp, tp) \
48 ((void)(cp), (void)(mp), (void)(tp), ISC_R_NOTIMPLEMENTED)
50 #define isc_condition_signal(cp) \
51 isc__nothread_signal_hack(cp)
53 #define isc_condition_broadcast(cp) \
54 ((void)(cp), ISC_R_NOTIMPLEMENTED)
56 #define isc_condition_destroy(cp) \
57 (*(cp) == 0 ? (*(cp) = -1, ISC_R_SUCCESS) : ISC_R_UNEXPECTED)
59 #endif /* ISC_CONDITION_H */