summaryrefslogtreecommitdiffstats
path: root/vendor/crossbeam-utils/src/sync/parker.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/crossbeam-utils/src/sync/parker.rs')
-rw-r--r--vendor/crossbeam-utils/src/sync/parker.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/vendor/crossbeam-utils/src/sync/parker.rs b/vendor/crossbeam-utils/src/sync/parker.rs
index e791c4485..9cb3a2601 100644
--- a/vendor/crossbeam-utils/src/sync/parker.rs
+++ b/vendor/crossbeam-utils/src/sync/parker.rs
@@ -122,7 +122,10 @@ impl Parker {
/// p.park_timeout(Duration::from_millis(500));
/// ```
pub fn park_timeout(&self, timeout: Duration) {
- self.park_deadline(Instant::now() + timeout)
+ match Instant::now().checked_add(timeout) {
+ Some(deadline) => self.park_deadline(deadline),
+ None => self.park(),
+ }
}
/// Blocks the current thread until the token is made available, or until a certain deadline.