refcount – Atomic Reference Counting C API (User)



Name

refcount_state_load_depends(…) – load state pointer (basic thread-safety)


Synopsis

#include < refcount.h >

void* refcount_state_load_depends(refcount_t volatile *sloc);


Description

The refcount_state_load_depends(…) function is used to load the state pointer from a refcount_t object. The load will be atomic and will strictly adhere to a thread-safety level of basic.

The ‘sloc’ parameter MUST point to NULL or a refcount_t object that MUST be acquired by or transferred to the calling thread before it calls into this function. The caller will be subjected to undefined-behavior if the ‘sloc’ parameter contains any value that violates those rules.

The function WILL load the state pointer from ‘sloc’ with dependant-load memory visibility semantics if it is not NULL. Architectures that do not support dependant-loads (e.g., The Alpha) will make use of an explicit #LoadLoad w/ Data-Dependency Hint style memory barrier.

Return Value

If successful, the refcount_state_load_depends(…) function returns a state pointer from the refcount_t object pointed to by ‘sloc’. Otherwise, it will return NULL.


Errors

The refcount_state_load_depends(…) function will fail if:

[NULL] – The value of ‘sloc’ was NULL.

[Undefined Behavior] - The values of ‘sloc’ or ‘count’ were invalid.