summaryrefslogtreecommitdiff
path: root/absl/synchronization/internal/per_thread_sem_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/synchronization/internal/per_thread_sem_test.cc')
-rw-r--r--absl/synchronization/internal/per_thread_sem_test.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/absl/synchronization/internal/per_thread_sem_test.cc b/absl/synchronization/internal/per_thread_sem_test.cc
index 63c8e56a..18b2458b 100644
--- a/absl/synchronization/internal/per_thread_sem_test.cc
+++ b/absl/synchronization/internal/per_thread_sem_test.cc
@@ -33,7 +33,7 @@
// primitives which might use PerThreadSem, most notably absl::Mutex.
namespace absl {
-inline namespace lts_2018_06_20 {
+inline namespace lts_2018_12_18 {
namespace synchronization_internal {
class SimpleSemaphore {
@@ -154,12 +154,15 @@ TEST_F(PerThreadSemTest, WithTimeout) {
TEST_F(PerThreadSemTest, Timeouts) {
absl::Time timeout = absl::Now() + absl::Milliseconds(50);
+ // Allow for a slight early return, to account for quality of implementation
+ // issues on various platforms.
+ const absl::Duration slop = absl::Microseconds(200);
EXPECT_FALSE(Wait(timeout));
- EXPECT_LE(timeout, absl::Now());
+ EXPECT_LE(timeout, absl::Now() + slop);
absl::Time negative_timeout = absl::UnixEpoch() - absl::Milliseconds(100);
EXPECT_FALSE(Wait(negative_timeout));
- EXPECT_LE(negative_timeout, absl::Now()); // trivially true :)
+ EXPECT_LE(negative_timeout, absl::Now() + slop); // trivially true :)
Post(GetOrCreateCurrentThreadIdentity());
// The wait here has an expired timeout, but we have a wake to consume,
@@ -170,5 +173,5 @@ TEST_F(PerThreadSemTest, Timeouts) {
} // namespace
} // namespace synchronization_internal
-} // inline namespace lts_2018_06_20
+} // inline namespace lts_2018_12_18
} // namespace absl