From 4972c72c5cf2f27e2a0846ce9ff5d377d3f2b7af Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Fri, 15 Dec 2017 11:12:12 -0800 Subject: Changes imported from Abseil "staging" branch: - f59c2332341d6b1a3e045d61eb0065f7a226f807 Avoid preprocessing '__CUDACC_VER__ >= 70000' on CUDA 9,... by Abseil Team - 12dd22cf967603e9a12d58abfe877989d61844e3 Internal change. by Greg Falcon GitOrigin-RevId: f59c2332341d6b1a3e045d61eb0065f7a226f807 Change-Id: If4f5274e6d638a2ac86f1377e6ac0481dc584f19 --- absl/base/spinlock_test_common.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'absl/base/spinlock_test_common.cc') diff --git a/absl/base/spinlock_test_common.cc b/absl/base/spinlock_test_common.cc index 6918603..1b50884 100644 --- a/absl/base/spinlock_test_common.cc +++ b/absl/base/spinlock_test_common.cc @@ -23,6 +23,7 @@ #include #include "gtest/gtest.h" +#include "absl/base/attributes.h" #include "absl/base/internal/low_level_scheduling.h" #include "absl/base/internal/scheduling_mode.h" #include "absl/base/internal/spinlock.h" @@ -53,7 +54,6 @@ namespace { static constexpr int kArrayLength = 10; static uint32_t values[kArrayLength]; - static SpinLock static_spinlock(base_internal::kLinkerInitialized); static SpinLock static_cooperative_spinlock( base_internal::kLinkerInitialized, @@ -61,6 +61,7 @@ static SpinLock static_cooperative_spinlock( static SpinLock static_noncooperative_spinlock( base_internal::kLinkerInitialized, base_internal::SCHEDULE_KERNEL_ONLY); + // Simple integer hash function based on the public domain lookup2 hash. // http://burtleburtle.net/bob/c/lookup2.c static uint32_t Hash32(uint32_t a, uint32_t c) { @@ -187,11 +188,9 @@ TEST(SpinLock, WaitCyclesEncoding) { SpinLockTest::DecodeWaitCycles(before_max_value); EXPECT_GT(expected_max_value_decoded, before_max_value_decoded); } - TEST(SpinLockWithThreads, StaticSpinLock) { ThreadedTest(&static_spinlock); } - TEST(SpinLockWithThreads, StackSpinLock) { SpinLock spinlock; ThreadedTest(&spinlock); -- cgit v1.2.3