GRPC Core
18.0.0
|
#include <grpc/support/port_platform.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <assert.h>
Data Structures | |
struct | sync_array_s |
Enumerations | |
enum | { event_sync_partitions = 31 } |
Functions | |
void | gpr_event_init (gpr_event *ev) |
— One-time event notification — More... | |
void | gpr_event_set (gpr_event *ev, void *value) |
Set *ev so that gpr_event_get() and gpr_event_wait() will return value. More... | |
void * | gpr_event_get (gpr_event *ev) |
Return the value set by gpr_event_set(ev, ...), or NULL if no such call has completed. More... | |
void * | gpr_event_wait (gpr_event *ev, gpr_timespec abs_deadline) |
Wait until *ev is set by gpr_event_set(ev, ...), or abs_deadline is exceeded, then return gpr_event_get(ev). More... | |
void | gpr_ref_init (gpr_refcount *r, int n) |
— Reference counting — More... | |
void | gpr_ref (gpr_refcount *r) |
Increment the reference count *r. More... | |
void | gpr_ref_non_zero (gpr_refcount *r) |
Increment the reference count *r. More... | |
void | gpr_refn (gpr_refcount *r, int n) |
Increment the reference count *r by n. More... | |
int | gpr_unref (gpr_refcount *r) |
Decrement the reference count *r and return non-zero iff it has reached zero. More... | |
int | gpr_ref_is_unique (gpr_refcount *r) |
Return non-zero iff the reference count of *r is one, and thus is owned by exactly one object. More... | |
void | gpr_stats_init (gpr_stats_counter *c, intptr_t n) |
— Stats counters — More... | |
void | gpr_stats_inc (gpr_stats_counter *c, intptr_t inc) |
*c += inc. More... | |
intptr_t | gpr_stats_read (const gpr_stats_counter *c) |
Return *c. More... | |
void* gpr_event_get | ( | gpr_event * | ev | ) |
Return the value set by gpr_event_set(ev, ...), or NULL if no such call has completed.
If the result is non-NULL, all operations that occurred prior to the gpr_event_set(ev, ...) set will be visible after this call returns. Requires: *ev initialized. This operation is faster than acquiring a mutex on most platforms.
void gpr_event_init | ( | gpr_event * | ev | ) |
void gpr_event_set | ( | gpr_event * | ev, |
void * | value | ||
) |
Set *ev so that gpr_event_get() and gpr_event_wait() will return value.
Requires: *ev initialized; value != NULL; no prior or concurrent calls to gpr_event_set(ev, ...) since initialization.
void* gpr_event_wait | ( | gpr_event * | ev, |
gpr_timespec | abs_deadline | ||
) |
Wait until *ev is set by gpr_event_set(ev, ...), or abs_deadline is exceeded, then return gpr_event_get(ev).
Requires: *ev initialized. Use abs_deadline==gpr_inf_future for no deadline. When the event has been signalled before the call, this operation is faster than acquiring a mutex on most platforms.
void gpr_ref | ( | gpr_refcount * | r | ) |
Increment the reference count *r.
Requires *r initialized.
void gpr_ref_init | ( | gpr_refcount * | r, |
int | n | ||
) |
— Reference counting —
These calls act on the type gpr_refcount. It requires no destruction.
Initialize *r to value n.
int gpr_ref_is_unique | ( | gpr_refcount * | r | ) |
Return non-zero iff the reference count of *r is one, and thus is owned by exactly one object.
void gpr_ref_non_zero | ( | gpr_refcount * | r | ) |
Increment the reference count *r.
Requires *r initialized. Crashes if refcount is zero
void gpr_refn | ( | gpr_refcount * | r, |
int | n | ||
) |
Increment the reference count *r by n.
Requires *r initialized, n > 0.
void gpr_stats_inc | ( | gpr_stats_counter * | c, |
intptr_t | inc | ||
) |
*c += inc.
Requires: *c initialized.
void gpr_stats_init | ( | gpr_stats_counter * | c, |
intptr_t | n | ||
) |
— Stats counters —
These calls act on the integral type gpr_stats_counter. It requires no destruction. Static instances may be initialized with gpr_stats_counter c = GPR_STATS_INIT; Beware: These operations do not imply memory barriers. Do not use them to synchronize other events.
Initialize *c to the value n.
intptr_t gpr_stats_read | ( | const gpr_stats_counter * | c | ) |
Return *c.
Requires: *c initialized.
int gpr_unref | ( | gpr_refcount * | r | ) |
Decrement the reference count *r and return non-zero iff it has reached zero.
. Requires *r initialized.