34 #ifndef GRPC_SUPPORT_SYNC_H 
   35 #define GRPC_SUPPORT_SYNC_H 
   59 #if defined(GPR_POSIX_SYNC) 
   61 #elif defined(GPR_WIN32) 
   63 #elif !defined(GPR_CUSTOM_SYNC) 
   64 #error Unable to determine platform for sync 
  215    typedef struct queue {
 
  228    void queue_init(queue *q) {
 
  237    void queue_destroy(queue *q) {
 
  244    void queue_append(queue *q, 
int x) {
 
  252      while (q->length == N) {
 
  255      if (q->length == 0) {  
 
  260      q->elem[(q->head + q->length) % N] = x;
 
  267    int queue_try_append(queue *q, 
int x) {
 
  270        if (q->length != N) {
 
  271          if (q->length == 0) {  
 
  274          q->elem[(q->head + q->length) % N] = x;
 
  286    int queue_remove(queue *q, 
int *head, 
gpr_timespec abs_deadline) {
 
  294      while (q->length == 0 &&
 
  295             !
gpr_cv_wait(&q->non_empty, &q->mu, abs_deadline)) {
 
  297      if (q->length != 0) {    
 
  299        if (q->length == N) {  
 
  302        *head = q->elem[q->head];
 
  303        q->head = (q->head + 1) % N;
 
void gpr_mu_lock(gpr_mu *mu)
 
void gpr_ref(gpr_refcount *r)
 
void gpr_stats_inc(gpr_stats_counter *c, gpr_intptr inc)
 
void * gpr_event_get(gpr_event *ev)
 
void gpr_refn(gpr_refcount *r, int n)
 
Definition: sync_generic.h:47
 
void gpr_once_init(gpr_once *once, void(*init_routine)(void))
 
gpr_intptr gpr_stats_read(const gpr_stats_counter *c)
 
void gpr_cv_destroy(gpr_cv *cv)
 
int gpr_mu_trylock(gpr_mu *mu)
 
int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline)
 
void * gpr_event_wait(gpr_event *ev, gpr_timespec abs_deadline)
 
gpr_timespec gpr_inf_future(gpr_clock_type type)
 
void gpr_event_set(gpr_event *ev, void *value)
 
pthread_once_t gpr_once
Definition: sync_posix.h:43
 
Definition: sync_generic.h:50
 
pthread_cond_t gpr_cv
Definition: sync_posix.h:42
 
void gpr_mu_init(gpr_mu *mu)
 
int gpr_unref(gpr_refcount *r)
 
Definition: sync_win32.h:39
 
void gpr_mu_unlock(gpr_mu *mu)
 
void gpr_cv_signal(gpr_cv *cv)
 
void gpr_cv_init(gpr_cv *cv)
 
void gpr_stats_init(gpr_stats_counter *c, gpr_intptr n)
 
void gpr_event_init(gpr_event *ev)
 
void gpr_mu_destroy(gpr_mu *mu)
 
Definition: sync_generic.h:41
 
void gpr_cv_broadcast(gpr_cv *cv)
 
void gpr_ref_init(gpr_refcount *r, int n)