27 #ifndef EMBB_BASE_C_COUNTER_H_ 28 #define EMBB_BASE_C_COUNTER_H_ 30 #include <embb/base/c/atomic.h> 49 typedef struct embb_counter_t {
50 embb_atomic_unsigned_int value;
63 embb_counter_t* counter
77 embb_counter_t* counter
90 embb_counter_t* counter
103 embb_counter_t* counter
114 embb_counter_t* counter
126 embb_counter_t* counter
opaque_type embb_counter_t
Opaque type representing a thread-safe counter.
Definition: counter.h:47
int embb_counter_init(embb_counter_t *counter)
Initializes counter and sets it to zero.
unsigned int embb_counter_decrement(embb_counter_t *counter)
Decrements counter and returns the old value.
void embb_counter_destroy(embb_counter_t *counter)
Destroys an initialized counter.
void embb_counter_reset(embb_counter_t *counter)
Resets an initialized counter to 0.
unsigned int embb_counter_increment(embb_counter_t *counter)
Increments counter and returns the old value.
unsigned int embb_counter_get(embb_counter_t *counter)
Returns the current value of counter.