"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.11.23/lib/isc/pthreads/include/isc/once.h" (7 Sep 2020, 982 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 "once.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_ONCE_H
   14 #define ISC_ONCE_H 1
   15 
   16 /*! \file */
   17 
   18 #include <pthread.h>
   19 
   20 #include <isc/platform.h>
   21 #include <isc/result.h>
   22 
   23 typedef pthread_once_t isc_once_t;
   24 
   25 #ifdef ISC_PLATFORM_BRACEPTHREADONCEINIT
   26 /*!
   27  * This accommodates systems that define PTHRAD_ONCE_INIT improperly.
   28  */
   29 #define ISC_ONCE_INIT { PTHREAD_ONCE_INIT }
   30 #else
   31 /*!
   32  * This is the usual case.
   33  */
   34 #define ISC_ONCE_INIT PTHREAD_ONCE_INIT
   35 #endif
   36 
   37 /* XXX We could do fancier error handling... */
   38 
   39 #define isc_once_do(op, f) \
   40     ((pthread_once((op), (f)) == 0) ? \
   41      ISC_R_SUCCESS : ISC_R_UNEXPECTED)
   42 
   43 #endif /* ISC_ONCE_H */