Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:31:55

0001 // Copyright 2017 The Abseil Authors.
0002 //
0003 // Licensed under the Apache License, Version 2.0 (the "License");
0004 // you may not use this file except in compliance with the License.
0005 // You may obtain a copy of the License at
0006 //
0007 //      https://www.apache.org/licenses/LICENSE-2.0
0008 //
0009 // Unless required by applicable law or agreed to in writing, software
0010 // distributed under the License is distributed on an "AS IS" BASIS,
0011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0012 // See the License for the specific language governing permissions and
0013 // limitations under the License.
0014 //
0015 
0016 #ifndef ABSL_SYNCHRONIZATION_INTERNAL_WAITER_H_
0017 #define ABSL_SYNCHRONIZATION_INTERNAL_WAITER_H_
0018 
0019 #include "absl/base/config.h"
0020 #include "absl/synchronization/internal/futex_waiter.h"
0021 #include "absl/synchronization/internal/pthread_waiter.h"
0022 #include "absl/synchronization/internal/sem_waiter.h"
0023 #include "absl/synchronization/internal/stdcpp_waiter.h"
0024 #include "absl/synchronization/internal/win32_waiter.h"
0025 
0026 // May be chosen at compile time via -DABSL_FORCE_WAITER_MODE=<index>
0027 #define ABSL_WAITER_MODE_FUTEX 0
0028 #define ABSL_WAITER_MODE_SEM 1
0029 #define ABSL_WAITER_MODE_CONDVAR 2
0030 #define ABSL_WAITER_MODE_WIN32 3
0031 #define ABSL_WAITER_MODE_STDCPP 4
0032 
0033 #if defined(ABSL_FORCE_WAITER_MODE)
0034 #define ABSL_WAITER_MODE ABSL_FORCE_WAITER_MODE
0035 #elif defined(ABSL_INTERNAL_HAVE_WIN32_WAITER)
0036 #define ABSL_WAITER_MODE ABSL_WAITER_MODE_WIN32
0037 #elif defined(ABSL_INTERNAL_HAVE_FUTEX_WAITER)
0038 #define ABSL_WAITER_MODE ABSL_WAITER_MODE_FUTEX
0039 #elif defined(ABSL_INTERNAL_HAVE_SEM_WAITER)
0040 #define ABSL_WAITER_MODE ABSL_WAITER_MODE_SEM
0041 #elif defined(ABSL_INTERNAL_HAVE_PTHREAD_WAITER)
0042 #define ABSL_WAITER_MODE ABSL_WAITER_MODE_CONDVAR
0043 #elif defined(ABSL_INTERNAL_HAVE_STDCPP_WAITER)
0044 #define ABSL_WAITER_MODE ABSL_WAITER_MODE_STDCPP
0045 #else
0046 #error ABSL_WAITER_MODE is undefined
0047 #endif
0048 
0049 namespace absl {
0050 ABSL_NAMESPACE_BEGIN
0051 namespace synchronization_internal {
0052 
0053 #if ABSL_WAITER_MODE == ABSL_WAITER_MODE_FUTEX
0054 using Waiter = FutexWaiter;
0055 #elif ABSL_WAITER_MODE == ABSL_WAITER_MODE_SEM
0056 using Waiter = SemWaiter;
0057 #elif ABSL_WAITER_MODE == ABSL_WAITER_MODE_CONDVAR
0058 using Waiter = PthreadWaiter;
0059 #elif ABSL_WAITER_MODE == ABSL_WAITER_MODE_WIN32
0060 using Waiter = Win32Waiter;
0061 #elif ABSL_WAITER_MODE == ABSL_WAITER_MODE_STDCPP
0062 using Waiter = StdcppWaiter;
0063 #endif
0064 
0065 }  // namespace synchronization_internal
0066 ABSL_NAMESPACE_END
0067 }  // namespace absl
0068 
0069 #endif  // ABSL_SYNCHRONIZATION_INTERNAL_WAITER_H_