"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.11.23/lib/isc/nothreads/include/isc/mutex.h" (7 Sep 2020, 971 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 "mutex.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 #ifndef ISC_MUTEX_H
   13 #define ISC_MUTEX_H 1
   14 
   15 #include <isc/result.h>     /* for ISC_R_ codes */
   16 
   17 typedef int isc_mutex_t;
   18 
   19 #define isc_mutex_init(mp) \
   20     (*(mp) = 0, ISC_R_SUCCESS)
   21 #define isc_mutex_lock(mp) \
   22     ((*(mp))++ == 0 ? ISC_R_SUCCESS : ISC_R_UNEXPECTED)
   23 #define isc_mutex_unlock(mp) \
   24     (--(*(mp)) == 0 ? ISC_R_SUCCESS : ISC_R_UNEXPECTED)
   25 #define isc_mutex_trylock(mp) \
   26     (*(mp) == 0 ? ((*(mp))++, ISC_R_SUCCESS) : ISC_R_LOCKBUSY)
   27 #define isc_mutex_destroy(mp) \
   28     (*(mp) == 0 ? (*(mp) = -1, ISC_R_SUCCESS) : ISC_R_UNEXPECTED)
   29 #define isc_mutex_stats(fp)
   30 
   31 #endif /* ISC_MUTEX_H */