Executes a block object only once for the lifetime of an application.
- iOS 4.0+
- macOS 10.6+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
A pointer to a
dispatchstructure that is used to test whether the block has completed or not.
The block object to execute once.
This function is useful for initialization of global data (singletons) in an application. Always call this function before using or testing any variables that are initialized by the block.
If called simultaneously from multiple threads, this function waits synchronously until the block has completed.
The predicate must point to a variable stored in global or static scope. The result of using a predicate with automatic or dynamic storage (including Objective-C instance variables) is undefined.