refcount – Atomic Reference Counting C API (User)
refcount_libinit(…) – initialize the refcount library (thread-safety: none)
#include < refcount.h >
The refcount_libinit() function is used to initialize the refcount library. The initialization of the refcount library will be not be atomic and will strictly adhere to a thread-safety level of none.
The refcount_libinit() function MUST be called one time, and the call MUST occur before any process can make use of any other part the refcount C API. Ideally, this function should be called fairly early in a processes lifetime, and before it creates any threads. Keep in mind that this function only has to be called one time at startup, after that the calling process can fully utilize all aspects of the refcount API, for the rest of its lifetime. Also, functions that have behavior that is analogous to the POSIX Threads pthread_once(…) function could be leveraged against this function in certain scenarios.
The refcount_libinit() function will fail if:
[Undefined Behavior] - A process makes use of the refcount C API before it calls refcount_libinit().