2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-07 18:15:34 +00:00
Files
bind/lib/isc/include/isc/condition.h

55 lines
1.5 KiB
C
Raw Normal View History

1998-12-12 20:48:14 +00:00
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
1998-12-12 20:48:14 +00:00
*/
1998-08-18 00:37:02 +00:00
2018-11-15 17:20:36 +01:00
#pragma once
/*! \file */
1998-08-18 00:37:02 +00:00
2018-11-15 17:20:36 +01:00
#include <errno.h>
#include <isc/error.h>
1999-03-04 02:38:48 +00:00
#include <isc/lang.h>
#include <isc/mutex.h>
#include <isc/result.h>
2018-11-16 15:33:22 +01:00
#include <isc/string.h>
#include <isc/types.h>
#include <isc/util.h>
1998-08-18 00:37:02 +00:00
1998-10-22 01:33:20 +00:00
typedef pthread_cond_t isc_condition_t;
1998-08-18 00:37:02 +00:00
#define isc_condition_init(cond) \
{ \
int _ret = pthread_cond_init(cond, NULL); \
ERRNO_CHECK(pthread_cond_init, _ret); \
2018-11-15 17:20:36 +01:00
}
1998-08-18 00:37:02 +00:00
#define isc_condition_wait(cp, mp) \
((pthread_cond_wait((cp), (mp)) == 0) ? ISC_R_SUCCESS \
: ISC_R_UNEXPECTED)
1998-08-20 22:21:35 +00:00
1998-10-22 01:33:20 +00:00
#define isc_condition_signal(cp) \
((pthread_cond_signal((cp)) == 0) ? ISC_R_SUCCESS : ISC_R_UNEXPECTED)
1998-10-22 01:33:20 +00:00
#define isc_condition_broadcast(cp) \
((pthread_cond_broadcast((cp)) == 0) ? ISC_R_SUCCESS : ISC_R_UNEXPECTED)
1998-10-22 01:33:20 +00:00
#define isc_condition_destroy(cp) \
((pthread_cond_destroy((cp)) == 0) ? ISC_R_SUCCESS : ISC_R_UNEXPECTED)
1998-10-22 01:33:20 +00:00
ISC_LANG_BEGINDECLS
isc_result_t
isc_condition_waituntil(isc_condition_t *, isc_mutex_t *, isc_time_t *);
1998-10-22 01:33:20 +00:00
1999-03-04 02:38:48 +00:00
ISC_LANG_ENDDECLS