1 .\" Copyright (c) 2008-2009 Apple Inc. All rights reserved.
7 .Nd execute a block only once
9 .Fd #include <dispatch/dispatch.h>
12 .Fa "dispatch_once_t *predicate" "void (^block)(void)"
16 .Fa "dispatch_once_t *predicate" "void *context" "void (*function)(void *)"
21 function provides a simple and efficient mechanism to run an initializer
22 exactly once, similar to
24 Well designed code hides the use of lazy initialization.
27 FILE *getlogfile(void)
29 static dispatch_once_t pred;
32 dispatch_once(&pred, ^{
33 logfile = fopen(MY_LOG_FILE, "a");
43 function is a wrapper around