Thread-safe counter.
More...
Thread-safe counter.
Opaque type representing a thread-safe counter.
Initializes counter
and sets it to zero.
- Returns
- EMBB_SUCCESS if counter could be initialized
EMBB_ERROR otherwise
- Concurrency
- Thread-safe and wait-free
- Parameters
-
[out] | counter | Pointer to counter |
Returns the current value of counter
.
- Precondition
counter
is not NULL.
- Returns
- Current value
- Concurrency
- Thread-safe and wait-free
- Parameters
-
[in] | counter | Pointer to counter |
Increments counter
and returns the old value.
- Precondition
counter
is not NULL.
- Returns
- Old, non-incremented value
- Concurrency
- Thread-safe and wait-free
- Parameters
-
[in,out] | counter | Pointer to counter |
Decrements counter
and returns the old value.
- Precondition
counter
is not NULL.
- Returns
- Old, non-decremented value
- Concurrency
- Thread-safe and wait-free
- Parameters
-
[in,out] | counter | Pointer to counter |
Resets an initialized counter to 0.
- Precondition
counter
is initialized and not NULL.
- Concurrency
- Thread-safe and wait-free
- Parameters
-
[in,out] | counter | Pointer to counter |
Destroys an initialized counter.
- Precondition
counter
is initialized and not NULL.
- Postcondition
counter
is invalid and cannot be used anymore
- Concurrency
- Thread-safe and wait-free
- Parameters
-
[out] | counter | Pointer to counter |