Classes | Enumerations | Functions | Variables
sync.cc File Reference
#include <grpc/support/port_platform.h>
#include <assert.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
Include dependency graph for sync.cc:

Go to the source code of this file.

Classes

struct  sync_array_s
 

Enumerations

enum  { event_sync_partitions = 31 }
 

Functions

static void event_initialize (void)
 
void * gpr_event_get (gpr_event *ev)
 
void gpr_event_init (gpr_event *ev)
 
void gpr_event_set (gpr_event *ev, void *value)
 
void * gpr_event_wait (gpr_event *ev, gpr_timespec abs_deadline)
 
void gpr_ref (gpr_refcount *r)
 
void gpr_ref_init (gpr_refcount *r, int n)
 
int gpr_ref_is_unique (gpr_refcount *r)
 
void gpr_ref_non_zero (gpr_refcount *r)
 
void gpr_refn (gpr_refcount *r, int n)
 
void gpr_stats_inc (gpr_stats_counter *c, intptr_t inc)
 
void gpr_stats_init (gpr_stats_counter *c, intptr_t n)
 
intptr_t gpr_stats_read (const gpr_stats_counter *c)
 
int gpr_unref (gpr_refcount *r)
 
static struct sync_array_shash (gpr_event *ev)
 

Variables

static gpr_once event_once = GPR_ONCE_INIT
 
static struct sync_array_s sync_array [event_sync_partitions]
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
event_sync_partitions 

Definition at line 31 of file sync.cc.

Function Documentation

◆ event_initialize()

static void event_initialize ( void  )
static

Definition at line 41 of file sync.cc.

◆ gpr_event_get()

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.

Definition at line 69 of file sync.cc.

◆ gpr_event_init()

void gpr_event_init ( gpr_event ev)

— One-time event notification —

These operations act on a gpr_event, which should be initialized with gpr_ev_init(), or with GPR_EVENT_INIT if static, e.g., static gpr_event event_var = GPR_EVENT_INIT; It requires no destruction.
Initialize *ev.

Definition at line 54 of file sync.cc.

◆ gpr_event_set()

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.

Definition at line 59 of file sync.cc.

◆ gpr_event_wait()

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.

Definition at line 73 of file sync.cc.

◆ gpr_ref()

void gpr_ref ( gpr_refcount r)

Increment the reference count *r. Requires *r initialized.

Definition at line 88 of file sync.cc.

◆ gpr_ref_init()

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.

Definition at line 86 of file sync.cc.

◆ gpr_ref_is_unique()

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.

Definition at line 109 of file sync.cc.

◆ gpr_ref_non_zero()

void gpr_ref_non_zero ( gpr_refcount r)

Increment the reference count *r. Requires *r initialized. Crashes if refcount is zero

Definition at line 90 of file sync.cc.

◆ gpr_refn()

void gpr_refn ( gpr_refcount r,
int  n 
)

Increment the reference count *r by n. Requires *r initialized, n > 0.

Definition at line 99 of file sync.cc.

◆ gpr_stats_inc()

void gpr_stats_inc ( gpr_stats_counter c,
intptr_t  inc 
)

*c += inc. Requires: *c initialized.

Definition at line 117 of file sync.cc.

◆ gpr_stats_init()

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.

Definition at line 113 of file sync.cc.

◆ gpr_stats_read()

intptr_t gpr_stats_read ( const gpr_stats_counter c)

Return *c. Requires: *c initialized.

Definition at line 121 of file sync.cc.

◆ gpr_unref()

int gpr_unref ( gpr_refcount r)

Decrement the reference count *r and return non-zero iff it has reached zero. . Requires *r initialized.

Definition at line 103 of file sync.cc.

◆ hash()

static struct sync_array_s* hash ( gpr_event ev)
static

Definition at line 50 of file sync.cc.

Variable Documentation

◆ event_once

gpr_once event_once = GPR_ONCE_INIT
static

Definition at line 40 of file sync.cc.

◆ sync_array

struct sync_array_s sync_array[event_sync_partitions]
static


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:33