diff options
author | Derek Mauro <dmauro@google.com> | 2023-03-21 07:30:38 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-03-21 07:31:48 -0700 |
commit | 276f88cb77dd543ae9cc4ed55c08fb5f74f405ea (patch) | |
tree | fdf03e39bcee86795f8f2515f806dcf836158bcd /absl/synchronization/internal/waiter.h | |
parent | 819272485a0c06abc8d7d62b188a6f54174881cb (diff) |
Add an implementation of Waiter that uses std::mutex/std::condition_variable
This implementation may at some point become the default on some
platforms. Currently not all platforms have widespread support for
both real absolute timeouts or real relative timeouts (here "real"
means without converting to the other timeout type which is the only
one supported by the underlying APIs). In this case we can defer to
their standard library to implement correct support.
This is not currently the default on any platform
Note: The size of WaiterState had to increase to fit the new implementation
PiperOrigin-RevId: 518266646
Change-Id: I7f246646a960d6e1b155f9de0bf2f681c5d3d245
Diffstat (limited to 'absl/synchronization/internal/waiter.h')
-rw-r--r-- | absl/synchronization/internal/waiter.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/absl/synchronization/internal/waiter.h b/absl/synchronization/internal/waiter.h index 07bba10a..1a8b0b83 100644 --- a/absl/synchronization/internal/waiter.h +++ b/absl/synchronization/internal/waiter.h @@ -20,6 +20,7 @@ #include "absl/synchronization/internal/futex_waiter.h" #include "absl/synchronization/internal/pthread_waiter.h" #include "absl/synchronization/internal/sem_waiter.h" +#include "absl/synchronization/internal/stdcpp_waiter.h" #include "absl/synchronization/internal/win32_waiter.h" // May be chosen at compile time via -DABSL_FORCE_WAITER_MODE=<index> @@ -27,6 +28,7 @@ #define ABSL_WAITER_MODE_SEM 1 #define ABSL_WAITER_MODE_CONDVAR 2 #define ABSL_WAITER_MODE_WIN32 3 +#define ABSL_WAITER_MODE_STDCPP 4 #if defined(ABSL_FORCE_WAITER_MODE) #define ABSL_WAITER_MODE ABSL_FORCE_WAITER_MODE @@ -54,6 +56,8 @@ using Waiter = SemWaiter; using Waiter = PthreadWaiter; #elif ABSL_WAITER_MODE == ABSL_WAITER_MODE_WIN32 using Waiter = Win32Waiter; +#elif ABSL_WAITER_MODE == ABSL_WAITER_MODE_STDCPP +using Waiter = StdcppWaiter; #endif } // namespace synchronization_internal |