diff options
author | Abseil Team <absl-team@google.com> | 2018-10-04 08:55:32 -0700 |
---|---|---|
committer | Alex Strelnikov <strel@google.com> | 2018-10-05 10:53:08 -0400 |
commit | e821380d69a549dc64900693942789d21aa4df5e (patch) | |
tree | 4969f84d2e677dfe645acfecc91d6c05e9c281a0 /absl/synchronization/notification_test.cc | |
parent | f21d187b80e3b7f08fb279775ea9c8b48c636030 (diff) | |
download | abseil-e821380d69a549dc64900693942789d21aa4df5e.tar.gz abseil-e821380d69a549dc64900693942789d21aa4df5e.tar.bz2 abseil-e821380d69a549dc64900693942789d21aa4df5e.zip |
Export of internal Abseil changes.
--
e09635c907d471ab46e14fb8091988c92cb4e78e by Abseil Team <absl-team@google.com>:
Fix syntax error in documentation '}' -> ')'
PiperOrigin-RevId: 215744854
--
a9e2d036850748137355f4a07083f1052d5c3766 by Abseil Team <absl-team@google.com>:
WrapUnique's comment about avoiding explicit template specification
doesn't make clear what alternative there is when this hurts
readability. Add a comment about the approved alternative.
PiperOrigin-RevId: 215634917
--
596b8ff41ff70b27bff3a2369038c0fe7d13ae85 by Greg Falcon <gfalcon@google.com>:
Allow for a small amount of slop in timeout tests, as not all OSs we support give us the perfect timing behavior we're testing for here.
PiperOrigin-RevId: 215615172
GitOrigin-RevId: e09635c907d471ab46e14fb8091988c92cb4e78e
Change-Id: I30721294bac86510a49bb7f405149fc74c532abb
Diffstat (limited to 'absl/synchronization/notification_test.cc')
-rw-r--r-- | absl/synchronization/notification_test.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/absl/synchronization/notification_test.cc b/absl/synchronization/notification_test.cc index 9b3b6a5a..d8708d55 100644 --- a/absl/synchronization/notification_test.cc +++ b/absl/synchronization/notification_test.cc @@ -71,10 +71,13 @@ static void BasicTests(bool notify_before_waiting, Notification* notification) { notification->WaitForNotificationWithTimeout(absl::Milliseconds(0))); EXPECT_FALSE(notification->WaitForNotificationWithDeadline(absl::Now())); + const absl::Duration delay = 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); absl::Time start = absl::Now(); - EXPECT_FALSE( - notification->WaitForNotificationWithTimeout(absl::Milliseconds(50))); - EXPECT_LE(start + absl::Milliseconds(50), absl::Now()); + EXPECT_FALSE(notification->WaitForNotificationWithTimeout(delay)); + EXPECT_LE(start + delay, absl::Now() + slop); ThreadSafeCounter ready_counter; ThreadSafeCounter done_counter; |