34 #ifndef GRPCXX_IMPL_SYNC_NO_CXX11_H
35 #define GRPCXX_IMPL_SYNC_NO_CXX11_H
37 #include <grpc/support/sync.h>
47 mutex() { gpr_mu_init(&mu_); }
48 ~
mutex() { gpr_mu_destroy(&mu_); }
51 template <
class mutex>
56 template <
class mutex>
60 ~lock_guard() { unlock_internal(); }
62 void lock_internal() {
63 if (!locked) gpr_mu_lock(&mu_.mu_);
66 void unlock_internal() {
67 if (locked) gpr_mu_unlock(&mu_.mu_);
73 friend class condition_variable;
76 template <
class mutex>
80 void lock() { lock_internal(); }
81 void unlock() { unlock_internal(); }
90 gpr_cv_wait(&cv_, &mu.mu_.mu_, gpr_inf_future);
93 void notify_one() { gpr_cv_signal(&cv_); }
94 void notify_all() { gpr_cv_broadcast(&cv_); }
101 #endif // GRPCXX_IMPL_SYNC_NO_CXX11_H
Definition: sync_no_cxx11.h:45
Definition: sync_no_cxx11.h:84
Definition: sync_win32.h:41
Definition: sync_no_cxx11.h:42
Definition: sync_no_cxx11.h:77