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 13 #ifndef ISC_ONCE_H 14 #define ISC_ONCE_H 1 15 16 #include <stdbool.h> 17 18 #include <isc/result.h> 19 20 typedef bool isc_once_t; 21 22 #define ISC_ONCE_INIT false 23 24 #define isc_once_do(op, f) \ 25 (!*(op) ? (f(), *(op) = true, ISC_R_SUCCESS) : ISC_R_SUCCESS) 26 27 #endif /* ISC_ONCE_H */ 28