From 276f88cb77dd543ae9cc4ed55c08fb5f74f405ea Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Tue, 21 Mar 2023 07:30:38 -0700 Subject: 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 --- absl/synchronization/internal/waiter.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'absl/synchronization/internal/waiter.h') 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= @@ -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 -- cgit v1.2.3