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 https://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_ONCE_H 13 #define ISC_ONCE_H 1 14 15 /*! \file */ 16 17 #include <pthread.h> 18 19 #include <isc/result.h> 20 21 typedef pthread_once_t isc_once_t; 22 23 #define ISC_ONCE_INIT PTHREAD_ONCE_INIT 24 25 /* XXX We could do fancier error handling... */ 26 27 #define isc_once_do(op, f) \ 28 ((pthread_once((op), (f)) == 0) ? ISC_R_SUCCESS : ISC_R_UNEXPECTED) 29 30 #endif /* ISC_ONCE_H */ 31