19 #ifndef GRPC_CORE_LIB_GPRPP_SYNC_H 20 #define GRPC_CORE_LIB_GPRPP_SYNC_H 49 const gpr_mu*
get()
const {
return &mu_; }
94 bool released_ =
false;
113 template <
typename Predicate>
Mutex & operator=(const Mutex &)=delete
ReleasableMutexLock(Mutex *mu)
Definition: sync.h:71
void Broadcast()
Definition: sync.h:106
int Wait(Mutex *mu)
Definition: sync.h:108
MutexLock & operator=(const MutexLock &)=delete
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type)
The zero time interval.
ReleasableMutexLock(gpr_mu *mu)
Definition: sync.h:72
CondVar & operator=(const CondVar &)=delete
GPRAPI int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline)
Atomically release *mu and wait on *cv.
~CondVar()
Definition: sync.h:100
Internal thread interface.
Definition: backoff.h:26
GPRAPI void gpr_cv_broadcast(gpr_cv *cv)
Wake all threads waiting on *cv.
MutexLock(Mutex *mu)
Definition: sync.h:58
~Mutex()
Definition: sync.h:43
pthread_cond_t gpr_cv
Definition: sync_posix.h:46
void Signal()
Definition: sync.h:105
~MutexLock()
Definition: sync.h:60
GPRAPI void gpr_cv_destroy(gpr_cv *cv)
Cause *cv no longer to be initialized, freeing any memory in use.
Definition: sync_windows.h:26
void Unlock()
Definition: sync.h:86
GPRAPI void gpr_mu_init(gpr_mu *mu)
— Mutex interface —
void Lock()
Definition: sync.h:80
Realtime clock.
Definition: gpr_types.h:36
GPRAPI void gpr_cv_signal(gpr_cv *cv)
If any threads are waiting on *cv, wake at least one.
GPRAPI void gpr_mu_unlock(gpr_mu *mu)
Release an exclusive lock on *mu held by the calling thread.
gpr_mu * get()
Definition: sync.h:48
int Wait(Mutex *mu, const gpr_timespec &deadline)
Definition: sync.h:109
Analogous to struct timespec.
Definition: gpr_types.h:47
MutexLock(gpr_mu *mu)
Definition: sync.h:59
#define GPR_DEBUG_ASSERT(x)
Definition: log.h:103
Mutex()
Definition: sync.h:42
GPRAPI void gpr_cv_init(gpr_cv *cv)
— Condition variable interface —
void WaitUntil(Mutex *mu, Predicate pred)
Definition: sync.h:114
ReleasableMutexLock & operator=(const ReleasableMutexLock &)=delete
GPRAPI void gpr_mu_lock(gpr_mu *mu)
Wait until no thread has a lock on *mu, cause the calling thread to own an exclusive lock on *mu...
GPRAPI void gpr_mu_destroy(gpr_mu *mu)
Cause *mu no longer to be initialized, freeing any memory in use.
~ReleasableMutexLock()
Definition: sync.h:73
CondVar()
Definition: sync.h:99