1 /*
2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3  *
4  * SPDX-License-Identifier: MPL-2.0
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0.  If a copy of the MPL was not distributed with this
8  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
9  *
10  * See the COPYRIGHT file distributed with this work for additional
11  * information regarding copyright ownership.
12  */
13 
14 #ifndef ISC_ONCE_H
15 #define ISC_ONCE_H 1
16 
17 #include <isc/lang.h>
18 #include <isc/result.h>
19 
20 ISC_LANG_BEGINDECLS
21 
22 typedef struct {
23 	int status;
24 	int counter;
25 } isc_once_t;
26 
27 #define ISC_ONCE_INIT_NEEDED 0
28 #define ISC_ONCE_INIT_DONE   1
29 
30 #define ISC_ONCE_INIT                   \
31 	{                               \
32 		ISC_ONCE_INIT_NEEDED, 1 \
33 	}
34 
35 isc_result_t
36 isc_once_do(isc_once_t *controller, void (*function)(void));
37 
38 ISC_LANG_ENDDECLS
39 
40 #endif /* ISC_ONCE_H */
41