P99

◆ P99_DEFINE_ONCE_CHAIN

#define P99_DEFINE_ONCE_CHAIN (   T,
  ... 
)
Value:
p99_once_flag p99_ ## T ## _once; \
void p00_ ## T ## _once_init(void)

Define a function that will be called exactly once by P99_INIT_CHAIN(T).

The function has a prototype of void someFunctionName(void).

T can be any valid identifier, the real function name will be mangled such that it will not clash with an existing name.

The ... list (optional) can be used to give a list of dependencies from other P99_INIT_CHAIN functions.

// initialize some shared ressource
}
P99_DEFINE_ONCE_CHAIN(tutu, toto) {
// empty
}

This will ensure that P99_INIT_CHAIN(toto) is always triggered by P99_INIT_CHAIN(tutu) and is run before we run the function tutu itself. As shown above in the example, many functions will be empty, serving just to ensure that all dynamic dependencies are initialized in the right order.

See also
P99_DECLARE_ONCE_CHAIN
P99_INIT_CHAIN

Definition at line 237 of file p99_threads.h.

p99_once_flag
complete object type that holds a flag for use by p99_call_once
Definition: p99_threads.h:62
P99_DEFINE_ONCE_CHAIN
#define P99_DEFINE_ONCE_CHAIN(T,...)
Define a function that will be called exactly once by P99_INIT_CHAIN(T).
Definition: p99_threads.h:237