diff options
author | Abseil Team <absl-team@google.com> | 2018-06-20 06:25:23 -0700 |
---|---|---|
committer | Shaindel Schwartz <shaindel@google.com> | 2018-06-20 10:15:31 -0400 |
commit | 6c7de165d1c82684359ccb630bb5f83263fa5ebc (patch) | |
tree | f271bc0005ad42773cc0140100699b8bfbaea124 /absl/synchronization | |
parent | e5be80532b5d998813f9db952d2cc5401b1532df (diff) |
Project import generated by Copybara.20180600
GitOrigin-RevId: d89dba27e35462d7457121b978fd79214205e686
Change-Id: I0eae80578a93a580820bc90d42e6b42faf7fde0a
Diffstat (limited to 'absl/synchronization')
25 files changed, 48 insertions, 6 deletions
diff --git a/absl/synchronization/BUILD.bazel b/absl/synchronization/BUILD.bazel index 123536ea..372874e1 100644 --- a/absl/synchronization/BUILD.bazel +++ b/absl/synchronization/BUILD.bazel @@ -149,12 +149,6 @@ cc_test( size = "large", srcs = ["mutex_test.cc"], copts = ABSL_TEST_COPTS, - tags = [ - "no_test_android_arm", - "no_test_android_arm64", - "no_test_android_x86", - "no_test_loonix", # Too slow. - ], deps = [ ":synchronization", ":thread_pool", diff --git a/absl/synchronization/barrier.cc b/absl/synchronization/barrier.cc index a1b3ad5c..545bb891 100644 --- a/absl/synchronization/barrier.cc +++ b/absl/synchronization/barrier.cc @@ -18,6 +18,7 @@ #include "absl/synchronization/mutex.h" namespace absl { +inline namespace lts_2018_06_20 { // Return whether int *arg is zero. static bool IsZero(void *arg) { @@ -47,4 +48,5 @@ bool Barrier::Block() { return this->num_to_exit_ == 0; } +} // inline namespace lts_2018_06_20 } // namespace absl diff --git a/absl/synchronization/barrier.h b/absl/synchronization/barrier.h index f834feec..ccae0a4c 100644 --- a/absl/synchronization/barrier.h +++ b/absl/synchronization/barrier.h @@ -23,6 +23,7 @@ #include "absl/synchronization/mutex.h" namespace absl { +inline namespace lts_2018_06_20 { // Barrier // @@ -73,5 +74,6 @@ class Barrier { int num_to_exit_ GUARDED_BY(lock_); }; +} // inline namespace lts_2018_06_20 } // namespace absl #endif // ABSL_SYNCHRONIZATION_BARRIER_H_ diff --git a/absl/synchronization/blocking_counter.cc b/absl/synchronization/blocking_counter.cc index 7e68e960..f998099a 100644 --- a/absl/synchronization/blocking_counter.cc +++ b/absl/synchronization/blocking_counter.cc @@ -17,6 +17,7 @@ #include "absl/base/internal/raw_logging.h" namespace absl { +inline namespace lts_2018_06_20 { // Return whether int *arg is zero. static bool IsZero(void *arg) { @@ -52,4 +53,5 @@ void BlockingCounter::Wait() { // after we return from this method. } +} // inline namespace lts_2018_06_20 } // namespace absl diff --git a/absl/synchronization/blocking_counter.h b/absl/synchronization/blocking_counter.h index 557ed028..08b6f58c 100644 --- a/absl/synchronization/blocking_counter.h +++ b/absl/synchronization/blocking_counter.h @@ -24,6 +24,7 @@ #include "absl/synchronization/mutex.h" namespace absl { +inline namespace lts_2018_06_20 { // BlockingCounter // @@ -92,6 +93,7 @@ class BlockingCounter { int num_waiting_ GUARDED_BY(lock_); }; +} // inline namespace lts_2018_06_20 } // namespace absl #endif // ABSL_SYNCHRONIZATION_BLOCKING_COUNTER_H_ diff --git a/absl/synchronization/blocking_counter_test.cc b/absl/synchronization/blocking_counter_test.cc index e8223f84..486aa9b1 100644 --- a/absl/synchronization/blocking_counter_test.cc +++ b/absl/synchronization/blocking_counter_test.cc @@ -22,6 +22,7 @@ #include "absl/time/time.h" namespace absl { +inline namespace lts_2018_06_20 { namespace { void PauseAndDecreaseCounter(BlockingCounter* counter, int* done) { @@ -63,4 +64,5 @@ TEST(BlockingCounterTest, BasicFunctionality) { } } // namespace +} // inline namespace lts_2018_06_20 } // namespace absl diff --git a/absl/synchronization/internal/create_thread_identity.cc b/absl/synchronization/internal/create_thread_identity.cc index e7a65cd8..38cc7e2f 100644 --- a/absl/synchronization/internal/create_thread_identity.cc +++ b/absl/synchronization/internal/create_thread_identity.cc @@ -27,6 +27,7 @@ #include "absl/synchronization/internal/per_thread_sem.h" namespace absl { +inline namespace lts_2018_06_20 { namespace synchronization_internal { // ThreadIdentity storage is persistent, we maintain a free-list of previously @@ -107,6 +108,7 @@ base_internal::ThreadIdentity* CreateThreadIdentity() { } } // namespace synchronization_internal +} // inline namespace lts_2018_06_20 } // namespace absl #endif // ABSL_LOW_LEVEL_ALLOC_MISSING diff --git a/absl/synchronization/internal/create_thread_identity.h b/absl/synchronization/internal/create_thread_identity.h index 1bb87dee..05b5f7e1 100644 --- a/absl/synchronization/internal/create_thread_identity.h +++ b/absl/synchronization/internal/create_thread_identity.h @@ -29,6 +29,7 @@ #include "absl/base/port.h" namespace absl { +inline namespace lts_2018_06_20 { namespace synchronization_internal { // Allocates and attaches a ThreadIdentity object for the calling thread. @@ -49,5 +50,6 @@ inline base_internal::ThreadIdentity* GetOrCreateCurrentThreadIdentity() { } } // namespace synchronization_internal +} // inline namespace lts_2018_06_20 } // namespace absl #endif // ABSL_SYNCHRONIZATION_INTERNAL_CREATE_THREAD_IDENTITY_H_ diff --git a/absl/synchronization/internal/graphcycles.cc b/absl/synchronization/internal/graphcycles.cc index ab1f3f84..5a015844 100644 --- a/absl/synchronization/internal/graphcycles.cc +++ b/absl/synchronization/internal/graphcycles.cc @@ -44,6 +44,7 @@ // Do not use STL. This module does not use standard memory allocation. namespace absl { +inline namespace lts_2018_06_20 { namespace synchronization_internal { namespace { @@ -694,6 +695,7 @@ int GraphCycles::GetStackTrace(GraphId id, void*** ptr) { } } // namespace synchronization_internal +} // inline namespace lts_2018_06_20 } // namespace absl #endif // ABSL_LOW_LEVEL_ALLOC_MISSING diff --git a/absl/synchronization/internal/graphcycles.h b/absl/synchronization/internal/graphcycles.h index 2e6686a4..e43ae26b 100644 --- a/absl/synchronization/internal/graphcycles.h +++ b/absl/synchronization/internal/graphcycles.h @@ -41,6 +41,7 @@ #include <cstdint> namespace absl { +inline namespace lts_2018_06_20 { namespace synchronization_internal { // Opaque identifier for a graph node. @@ -132,6 +133,7 @@ class GraphCycles { }; } // namespace synchronization_internal +} // inline namespace lts_2018_06_20 } // namespace absl #endif diff --git a/absl/synchronization/internal/graphcycles_test.cc b/absl/synchronization/internal/graphcycles_test.cc index 9a85b390..09332bad 100644 --- a/absl/synchronization/internal/graphcycles_test.cc +++ b/absl/synchronization/internal/graphcycles_test.cc @@ -25,6 +25,7 @@ #include "absl/base/macros.h" namespace absl { +inline namespace lts_2018_06_20 { namespace synchronization_internal { // We emulate a GraphCycles object with a node vector and an edge vector. @@ -459,4 +460,5 @@ TEST_F(GraphCyclesTest, ManyEdges) { } } // namespace synchronization_internal +} // inline namespace lts_2018_06_20 } // namespace absl diff --git a/absl/synchronization/internal/kernel_timeout.h b/absl/synchronization/internal/kernel_timeout.h index 0d132d98..3d3dc0cb 100644 --- a/absl/synchronization/internal/kernel_timeout.h +++ b/absl/synchronization/internal/kernel_timeout.h @@ -37,6 +37,7 @@ #include "absl/time/time.h" namespace absl { +inline namespace lts_2018_06_20 { namespace synchronization_internal { class Futex; @@ -145,5 +146,6 @@ class KernelTimeout { }; } // namespace synchronization_internal +} // inline namespace lts_2018_06_20 } // namespace absl #endif // ABSL_SYNCHRONIZATION_INTERNAL_KERNEL_TIMEOUT_H_ diff --git a/absl/synchronization/internal/mutex_nonprod.cc b/absl/synchronization/internal/mutex_nonprod.cc index 45c60326..a8071a96 100644 --- a/absl/synchronization/internal/mutex_nonprod.cc +++ b/absl/synchronization/internal/mutex_nonprod.cc @@ -31,6 +31,7 @@ #include "absl/time/time.h" namespace absl { +inline namespace lts_2018_06_20 { namespace synchronization_internal { namespace { @@ -315,4 +316,5 @@ bool Condition::Eval() const { void RegisterSymbolizer(bool (*)(const void*, char*, int)) {} +} // inline namespace lts_2018_06_20 } // namespace absl diff --git a/absl/synchronization/internal/mutex_nonprod.inc b/absl/synchronization/internal/mutex_nonprod.inc index 0aab3d13..2d06285f 100644 --- a/absl/synchronization/internal/mutex_nonprod.inc +++ b/absl/synchronization/internal/mutex_nonprod.inc @@ -36,6 +36,7 @@ #endif namespace absl { +inline namespace lts_2018_06_20 { class Condition; namespace synchronization_internal { @@ -253,4 +254,5 @@ class SynchronizationStorage { }; } // namespace synchronization_internal +} // inline namespace lts_2018_06_20 } // namespace absl diff --git a/absl/synchronization/internal/per_thread_sem.cc b/absl/synchronization/internal/per_thread_sem.cc index caa2baf6..53b789d6 100644 --- a/absl/synchronization/internal/per_thread_sem.cc +++ b/absl/synchronization/internal/per_thread_sem.cc @@ -25,6 +25,7 @@ #include "absl/synchronization/internal/waiter.h" namespace absl { +inline namespace lts_2018_06_20 { namespace synchronization_internal { void PerThreadSem::SetThreadBlockedCounter(std::atomic<int> *counter) { @@ -58,6 +59,7 @@ void PerThreadSem::Tick(base_internal::ThreadIdentity *identity) { } } // namespace synchronization_internal +} // inline namespace lts_2018_06_20 } // namespace absl extern "C" { diff --git a/absl/synchronization/internal/per_thread_sem.h b/absl/synchronization/internal/per_thread_sem.h index 678b69e4..fc64f768 100644 --- a/absl/synchronization/internal/per_thread_sem.h +++ b/absl/synchronization/internal/per_thread_sem.h @@ -32,6 +32,7 @@ #include "absl/synchronization/internal/kernel_timeout.h" namespace absl { +inline namespace lts_2018_06_20 { class Mutex; @@ -80,6 +81,7 @@ class PerThreadSem { }; } // namespace synchronization_internal +} // inline namespace lts_2018_06_20 } // namespace absl // In some build configurations we pass --detect-odr-violations to the diff --git a/absl/synchronization/internal/per_thread_sem_test.cc b/absl/synchronization/internal/per_thread_sem_test.cc index 2b52ea76..63c8e56a 100644 --- a/absl/synchronization/internal/per_thread_sem_test.cc +++ b/absl/synchronization/internal/per_thread_sem_test.cc @@ -33,6 +33,7 @@ // primitives which might use PerThreadSem, most notably absl::Mutex. namespace absl { +inline namespace lts_2018_06_20 { namespace synchronization_internal { class SimpleSemaphore { @@ -169,4 +170,5 @@ TEST_F(PerThreadSemTest, Timeouts) { } // namespace } // namespace synchronization_internal +} // inline namespace lts_2018_06_20 } // namespace absl diff --git a/absl/synchronization/internal/thread_pool.h b/absl/synchronization/internal/thread_pool.h index 84640427..82dedbf5 100644 --- a/absl/synchronization/internal/thread_pool.h +++ b/absl/synchronization/internal/thread_pool.h @@ -25,6 +25,7 @@ #include "absl/synchronization/mutex.h" namespace absl { +inline namespace lts_2018_06_20 { namespace synchronization_internal { // A simple ThreadPool implementation for tests. @@ -85,6 +86,7 @@ class ThreadPool { }; } // namespace synchronization_internal +} // inline namespace lts_2018_06_20 } // namespace absl #endif // ABSL_SYNCHRONIZATION_INTERNAL_THREAD_POOL_H_ diff --git a/absl/synchronization/internal/waiter.cc b/absl/synchronization/internal/waiter.cc index 768c5208..ad86acce 100644 --- a/absl/synchronization/internal/waiter.cc +++ b/absl/synchronization/internal/waiter.cc @@ -46,6 +46,7 @@ #include "absl/synchronization/internal/kernel_timeout.h" namespace absl { +inline namespace lts_2018_06_20 { namespace synchronization_internal { static void MaybeBecomeIdle() { @@ -409,4 +410,5 @@ void Waiter::Poke() { #endif } // namespace synchronization_internal +} // inline namespace lts_2018_06_20 } // namespace absl diff --git a/absl/synchronization/internal/waiter.h b/absl/synchronization/internal/waiter.h index 23166f4b..1c284c0a 100644 --- a/absl/synchronization/internal/waiter.h +++ b/absl/synchronization/internal/waiter.h @@ -53,6 +53,7 @@ #endif namespace absl { +inline namespace lts_2018_06_20 { namespace synchronization_internal { // Waiter is an OS-specific semaphore. @@ -134,6 +135,7 @@ class Waiter { }; } // namespace synchronization_internal +} // inline namespace lts_2018_06_20 } // namespace absl #endif // ABSL_SYNCHRONIZATION_INTERNAL_WAITER_H_ diff --git a/absl/synchronization/mutex.cc b/absl/synchronization/mutex.cc index e6525046..14e24a76 100644 --- a/absl/synchronization/mutex.cc +++ b/absl/synchronization/mutex.cc @@ -71,6 +71,7 @@ ABSL_ATTRIBUTE_WEAK void AbslInternalMutexYield() { std::this_thread::yield(); } } // extern "C" namespace absl { +inline namespace lts_2018_06_20 { namespace { @@ -2684,4 +2685,5 @@ bool Condition::GuaranteedEqual(const Condition *a, const Condition *b) { a->arg_ == b->arg_ && a->method_ == b->method_; } +} // inline namespace lts_2018_06_20 } // namespace absl diff --git a/absl/synchronization/mutex.h b/absl/synchronization/mutex.h index 840b9d6b..b5276037 100644 --- a/absl/synchronization/mutex.h +++ b/absl/synchronization/mutex.h @@ -81,6 +81,7 @@ #endif namespace absl { +inline namespace lts_2018_06_20 { class Condition; struct SynchWaitParams; @@ -1014,6 +1015,7 @@ enum class OnDeadlockCycle { // the manner chosen here. void SetMutexDeadlockDetectionMode(OnDeadlockCycle mode); +} // inline namespace lts_2018_06_20 } // namespace absl // In some build configurations we pass --detect-odr-violations to the diff --git a/absl/synchronization/notification.cc b/absl/synchronization/notification.cc index ed8cc906..a38acc5f 100644 --- a/absl/synchronization/notification.cc +++ b/absl/synchronization/notification.cc @@ -22,6 +22,7 @@ #include "absl/time/time.h" namespace absl { +inline namespace lts_2018_06_20 { void Notification::Notify() { MutexLock l(&this->mutex_); @@ -81,4 +82,5 @@ bool Notification::WaitForNotificationWithDeadline(absl::Time deadline) const { return notified; } +} // inline namespace lts_2018_06_20 } // namespace absl diff --git a/absl/synchronization/notification.h b/absl/synchronization/notification.h index 107932f2..99f8ee63 100644 --- a/absl/synchronization/notification.h +++ b/absl/synchronization/notification.h @@ -56,6 +56,7 @@ #include "absl/time/time.h" namespace absl { +inline namespace lts_2018_06_20 { // ----------------------------------------------------------------------------- // Notification @@ -108,5 +109,6 @@ class Notification { std::atomic<bool> notified_yet_; // written under mutex_ }; +} // inline namespace lts_2018_06_20 } // namespace absl #endif // ABSL_SYNCHRONIZATION_NOTIFICATION_H_ diff --git a/absl/synchronization/notification_test.cc b/absl/synchronization/notification_test.cc index 9b3b6a5a..83e17e34 100644 --- a/absl/synchronization/notification_test.cc +++ b/absl/synchronization/notification_test.cc @@ -21,6 +21,7 @@ #include "absl/synchronization/mutex.h" namespace absl { +inline namespace lts_2018_06_20 { // A thread-safe class that holds a counter. class ThreadSafeCounter { @@ -121,4 +122,5 @@ TEST(NotificationTest, SanityTest) { BasicTests(true, &local_notification2); } +} // inline namespace lts_2018_06_20 } // namespace absl |