File indexing completed on 2025-01-30 09:31:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ABSL_SYNCHRONIZATION_INTERNAL_STDCPP_WAITER_H_
0017 #define ABSL_SYNCHRONIZATION_INTERNAL_STDCPP_WAITER_H_
0018
0019 #include <condition_variable> // NOLINT(build/c++11)
0020 #include <mutex> // NOLINT(build/c++11)
0021
0022 #include "absl/base/config.h"
0023 #include "absl/synchronization/internal/kernel_timeout.h"
0024 #include "absl/synchronization/internal/waiter_base.h"
0025
0026 namespace absl {
0027 ABSL_NAMESPACE_BEGIN
0028 namespace synchronization_internal {
0029
0030 #define ABSL_INTERNAL_HAVE_STDCPP_WAITER 1
0031
0032 class StdcppWaiter : public WaiterCrtp<StdcppWaiter> {
0033 public:
0034 StdcppWaiter();
0035
0036 bool Wait(KernelTimeout t);
0037 void Post();
0038 void Poke();
0039
0040 static constexpr char kName[] = "StdcppWaiter";
0041
0042 private:
0043
0044 void InternalCondVarPoke();
0045
0046 std::mutex mu_;
0047 std::condition_variable cv_;
0048 int waiter_count_;
0049 int wakeup_count_;
0050 };
0051
0052 }
0053 ABSL_NAMESPACE_END
0054 }
0055
0056 #endif