"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.11.23/lib/isc/pthreads/include/isc/condition.h" (7 Sep 2020, 1477 Bytes) of package /linux/misc/dns/bind9/9.11.23/bind-9.11.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "condition.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
    3  *
    4  * This Source Code Form is subject to the terms of the Mozilla Public
    5  * License, v. 2.0. If a copy of the MPL was not distributed with this
    6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    7  *
    8  * See the COPYRIGHT file distributed with this work for additional
    9  * information regarding copyright ownership.
   10  */
   11 
   12 
   13 #ifndef ISC_CONDITION_H
   14 #define ISC_CONDITION_H 1
   15 
   16 /*! \file */
   17 
   18 #include <isc/lang.h>
   19 #include <isc/mutex.h>
   20 #include <isc/result.h>
   21 #include <isc/types.h>
   22 
   23 typedef pthread_cond_t isc_condition_t;
   24 
   25 #define isc_condition_init(cp) \
   26     ((pthread_cond_init((cp), NULL) == 0) ? \
   27      ISC_R_SUCCESS : ISC_R_UNEXPECTED)
   28 
   29 #if ISC_MUTEX_PROFILE
   30 #define isc_condition_wait(cp, mp) \
   31     ((pthread_cond_wait((cp), &((mp)->mutex)) == 0) ? \
   32      ISC_R_SUCCESS : ISC_R_UNEXPECTED)
   33 #else
   34 #define isc_condition_wait(cp, mp) \
   35     ((pthread_cond_wait((cp), (mp)) == 0) ? \
   36      ISC_R_SUCCESS : ISC_R_UNEXPECTED)
   37 #endif
   38 
   39 #define isc_condition_signal(cp) \
   40     ((pthread_cond_signal((cp)) == 0) ? \
   41      ISC_R_SUCCESS : ISC_R_UNEXPECTED)
   42 
   43 #define isc_condition_broadcast(cp) \
   44     ((pthread_cond_broadcast((cp)) == 0) ? \
   45      ISC_R_SUCCESS : ISC_R_UNEXPECTED)
   46 
   47 #define isc_condition_destroy(cp) \
   48     ((pthread_cond_destroy((cp)) == 0) ? \
   49      ISC_R_SUCCESS : ISC_R_UNEXPECTED)
   50 
   51 ISC_LANG_BEGINDECLS
   52 
   53 isc_result_t
   54 isc_condition_waituntil(isc_condition_t *, isc_mutex_t *, isc_time_t *);
   55 
   56 ISC_LANG_ENDDECLS
   57 
   58 #endif /* ISC_CONDITION_H */