once.h

Introduction

Use the links in the table of contents to the left to access the documentation.



Functions

DISPATCH_NONNULL3

Execute a block once and only once.

dispatch_once

Execute a block once and only once.


DISPATCH_NONNULL3


Execute a block once and only once.

 DISPATCH_NONNULL1 DISPATCH_NONNULL3  (
    "Use lazily initialized globals instead") void _dispatch_once_f(
    dispatch_once_t *predicate,
    void *_Nullable context, 
    dispatch_function_t function) 
Parameters
predicate

A pointer to a dispatch_once_t that is used to test whether the block has completed or not.

block

The block to execute once.

predicate

A pointer to a dispatch_once_t that is used to test whether the block has completed or not.

block

The block to execute once.

Discussion

Always call dispatch_once() before using or testing any variables that are initialized by the block.

See Also


dispatch_once


Execute a block once and only once.

#if (defined( 1)) 
 (macos(
        10.6), ios(
        4.0))  (
    "Use lazily initialized globals instead") void dispatch_once(
    dispatch_once_t *predicate, 
    DISPATCH_NOESCAPE dispatch_block_t block);  
#if ( DISPATCH_ONCE_INLINE_FASTPATH) 
  (
    "Use lazily initialized globals instead") void _dispatch_once(dispatch_once_t *predicate, 
    DISPATCH_NOESCAPE dispatch_block_t block) { 
    if (DISPATCH_EXPECT(
            *predicate,
            ~0l) != ~0l) { 
        dispatch_once(
            predicate,
            block); 
        } else { 
        dispatch_compiler_barrier(); 
        } DISPATCH_COMPILER_CAN_ASSUME(
        *predicate == ~0l); 
} #undef dispatch_once 
#define dispatch_once _dispatch_once 
#endif  
#endif 
// DISPATCH_ONCE_INLINE_FASTPATH  
(
    macos(
        10.6),
    ios(
        4.0)) DISPATCH_NONNULL1 DISPATCH_NONNULL3  (
    "Use lazily initialized globals instead") void dispatch_once_f(
    dispatch_once_t *predicate,
    void *_Nullable context, 
    dispatch_function_t function);  
#if ( DISPATCH_ONCE_INLINE_FASTPATH) 
 DISPATCH_NONNULL1 DISPATCH_NONNULL3  (
    "Use lazily initialized globals instead") void _dispatch_once_f(
    dispatch_once_t *predicate,
    void *_Nullable context, 
    dispatch_function_t function) 
#define dispatch_once_f _dispatch_once_f 
#endif 
// DISPATCH_ONCE_INLINE_FASTPATH 
   DISPATCH_ASSUME_NONNULL_END   #endif 
/* __DISPATCH_ONCE__ */
Parameters
predicate

A pointer to a dispatch_once_t that is used to test whether the block has completed or not.

block

The block to execute once.

Discussion

Always call dispatch_once() before using or testing any variables that are initialized by the block.

See Also

Availability

Typedefs

dispatch_once_t

A predicate for use with dispatch_once(). It must be initialized to zero. Note: static and global variables default to zero.


dispatch_once_t


A predicate for use with dispatch_once(). It must be initialized to zero. Note: static and global variables default to zero.

(
    "Use lazily initialized globals instead") typedef intptr_t dispatch_once_t;  

Macro Definitions

dispatch_once

Execute a block once and only once.

dispatch_once_f

Execute a block once and only once.


dispatch_once


Execute a block once and only once.

#define dispatch_once_f _dispatch_once_f 
Parameters
predicate

A pointer to a dispatch_once_t that is used to test whether the block has completed or not.

block

The block to execute once.

Discussion

Always call dispatch_once() before using or testing any variables that are initialized by the block.

See Also


dispatch_once_f


Execute a block once and only once.

#define dispatch_once_f _dispatch_once_f 
Parameters
predicate

A pointer to a dispatch_once_t that is used to test whether the block has completed or not.

block

The block to execute once.

Discussion

Always call dispatch_once() before using or testing any variables that are initialized by the block.

See Also