summaryrefslogtreecommitdiffstats
path: root/vendor/crossbeam-channel
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/crossbeam-channel')
-rw-r--r--vendor/crossbeam-channel/.cargo-checksum.json2
-rw-r--r--vendor/crossbeam-channel/CHANGELOG.md18
-rw-r--r--vendor/crossbeam-channel/Cargo.lock45
-rw-r--r--vendor/crossbeam-channel/Cargo.toml2
-rw-r--r--vendor/crossbeam-channel/src/channel.rs30
-rw-r--r--vendor/crossbeam-channel/src/flavors/at.rs7
-rw-r--r--vendor/crossbeam-channel/src/flavors/list.rs11
-rw-r--r--vendor/crossbeam-channel/src/flavors/tick.rs5
-rw-r--r--vendor/crossbeam-channel/src/select.rs10
-rw-r--r--vendor/crossbeam-channel/src/utils.rs8
-rw-r--r--vendor/crossbeam-channel/tests/golang.rs2
-rw-r--r--vendor/crossbeam-channel/tests/ready.rs1
12 files changed, 85 insertions, 56 deletions
diff --git a/vendor/crossbeam-channel/.cargo-checksum.json b/vendor/crossbeam-channel/.cargo-checksum.json
index 96db2f1ab..378146617 100644
--- a/vendor/crossbeam-channel/.cargo-checksum.json
+++ b/vendor/crossbeam-channel/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"f87a526ab720644e07509dd76d29c08993a5e52a6d6ec230d809fc31a1c0e403","Cargo.lock":"8af0a5f8b3d1e6f036332a5ecc91b30222343f29a465ea398bca3298c0212f4a","Cargo.toml":"81a227ee6f529cd0cf62327f63eb098fed59c04dde2a8e68aeaa0ea32dbafbcf","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","LICENSE-THIRD-PARTY":"b16db96b93b1d7cf7bea533f572091ec6bca3234fbe0a83038be772ff391a44c","README.md":"4e16587d8f6a15f2016f256535aa6c9429424672ebdcd03c1a7d964746e46127","benches/crossbeam.rs":"96cb1abd23cac3ef8a7174a802e94609926b555bb02c9658c78723d433f1dd92","examples/fibonacci.rs":"4e88fa40048cdc31e9c7bb60347d46f92543d7ddf39cab3b52bfe44affdb6a02","examples/matching.rs":"63c250e164607a7a9f643d46f107bb5da846d49e89cf9069909562d20e530f71","examples/stopwatch.rs":"d02121258f08d56f1eb7997e19bcb9bacb6836cfa0abbba90a9e59d8a50ae5cf","src/channel.rs":"9538e285101c152e23c5ff6a47b0305753d94a5b27f3426499052b0e3d0f97ee","src/context.rs":"ff4d39639ddf16aaab582d4a5f3d10ef2c71afe1abbf4e60f3d9d2ddbd72c230","src/counter.rs":"c49a9f44587888850edeb62f7c8ecd1acecb39c836834254ff3ac934c478440a","src/err.rs":"44cb2024ee6b0cd6fd24996430e53720769f64b4ac35016bc3e05cb9db48681d","src/flavors/array.rs":"508e54587fc8d9e8dfacd16446a601e33838d7bb1dfd9d7ccc3e65315b66b35a","src/flavors/at.rs":"1db64919593b7c14f838c16a22732515f1e716d2d5f6cc639f42631380e545cd","src/flavors/list.rs":"d901d9259185a71aeb5cf74be70e5c38b550c7f38b87e023196cb47fed2d1a11","src/flavors/mod.rs":"3d9d43bc38b0adb18c96c995c2bd3421d8e33ab6c30b20c3c467d21d48e485dc","src/flavors/never.rs":"747da857aa1a7601641f23f4930e6ad00ebaf50456d9be5c7aa270e2ecc24dcb","src/flavors/tick.rs":"69b2dfe0186bc8b9fd7a73e32da59d2656d8150da1e00fba92a412e0907568a3","src/flavors/zero.rs":"7458eb0ece475dc5093b4f2cde13f6de57e4f70291258850de4fa3c951c8f594","src/lib.rs":"3a65706d4124844ffc4c8cb1f8cc779631ec94f449f85cbb68364ad3619404f1","src/select.rs":"3b00c3929d3a8973e46188db41f6ae0b47c89ab108cf7ec2cb348e272e77e132","src/select_macro.rs":"283acd04870356b0c4d3d4046c5070638b562c9ffb8fa29c1a5b90a2509bf3af","src/utils.rs":"0b6e6621198236c077fcb6b66203317e36dc8f1a157dd3b22ad422b6599ae389","src/waker.rs":"6839108d1c9357b3c0c1c162c8b4633ff5ac4f756e95e677ac1293e7df942635","tests/after.rs":"0154a8e152880db17a20514ecdd49dabc361d3629858d119b9746b5e932c780c","tests/array.rs":"a57ae6264e676f573d7adb5c4b024994e98bc6811352516adb3444f880f7125e","tests/golang.rs":"284bed0d4c07857f33de96f2addc9a69c5688f864935a3e3e113c88c04bd826b","tests/iter.rs":"25dc02135bbae9d47a30f9047661648e66bdc134e40ba78bc2fbacbb8b3819bc","tests/list.rs":"3d1a4ae23bb6b4767242b8109a8efda26f1d3b28c0f90da3368f8eb9ca0eee37","tests/mpsc.rs":"d1e185c6290240132a34aa91221271225959f8652d7fc4ceb546ee9712361176","tests/never.rs":"ee40c4fc4dd5af4983fae8de6927f52b81174d222c162f745b26c4a6c7108e4f","tests/ready.rs":"d349702f123925a0781b48d677e6dcf64fc5d1fc788a7bf1e151a3d57e81871c","tests/same_channel.rs":"2bab761443671e841e1b2476bd8082d75533a2f6be7946f5dbcee67cdc82dccb","tests/select.rs":"ce12a8e0284fb9ccf6c1543bec309d9054193e6d942663aed19aa8499ef69c43","tests/select_macro.rs":"597d526fbd021ce70619d9172c931439f778ee3034ec1479aea461b65971a81a","tests/thread_locals.rs":"25ab70a8dcd8a0da9173e5476e17dcc8916caa5b68207d9c403655deaa8e8f4a","tests/tick.rs":"5f697bd14c48505d932e82065b5302ef668e1cc19cac18e8ac22e0c83c221c1d","tests/zero.rs":"9c5af802d5efb2c711f8242b8905ed29cc2601e48dbd95e41c7e6fbfe2918398"},"package":"c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521"} \ No newline at end of file
+{"files":{"CHANGELOG.md":"bcaef3a8c2edc691ca40e81865a3a176610706f159d34cf8b45ee4337ebd6369","Cargo.lock":"6695f914942ea8ef6862f7d84731ddbefb0f821cb5964059d4f952729d91c8ec","Cargo.toml":"fe61d89e41142b9b83de137dfbc0e21f3c4249aedefe535241dc85d36cc6e024","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","LICENSE-THIRD-PARTY":"b16db96b93b1d7cf7bea533f572091ec6bca3234fbe0a83038be772ff391a44c","README.md":"4e16587d8f6a15f2016f256535aa6c9429424672ebdcd03c1a7d964746e46127","benches/crossbeam.rs":"96cb1abd23cac3ef8a7174a802e94609926b555bb02c9658c78723d433f1dd92","examples/fibonacci.rs":"4e88fa40048cdc31e9c7bb60347d46f92543d7ddf39cab3b52bfe44affdb6a02","examples/matching.rs":"63c250e164607a7a9f643d46f107bb5da846d49e89cf9069909562d20e530f71","examples/stopwatch.rs":"d02121258f08d56f1eb7997e19bcb9bacb6836cfa0abbba90a9e59d8a50ae5cf","src/channel.rs":"13fbbe12d4ec361855af1c3587fc80aea5f537db8dc44dd4f66c9e2b4ae9f5c1","src/context.rs":"ff4d39639ddf16aaab582d4a5f3d10ef2c71afe1abbf4e60f3d9d2ddbd72c230","src/counter.rs":"c49a9f44587888850edeb62f7c8ecd1acecb39c836834254ff3ac934c478440a","src/err.rs":"44cb2024ee6b0cd6fd24996430e53720769f64b4ac35016bc3e05cb9db48681d","src/flavors/array.rs":"508e54587fc8d9e8dfacd16446a601e33838d7bb1dfd9d7ccc3e65315b66b35a","src/flavors/at.rs":"04e07861534f2f7d5b5f884f2f5bc9c008427e6d0afa1c8ad401e1d7e54b57eb","src/flavors/list.rs":"b3820f2d5c063cbccd658317af991885f68dfbbece483807d4ea36070ff5efba","src/flavors/mod.rs":"3d9d43bc38b0adb18c96c995c2bd3421d8e33ab6c30b20c3c467d21d48e485dc","src/flavors/never.rs":"747da857aa1a7601641f23f4930e6ad00ebaf50456d9be5c7aa270e2ecc24dcb","src/flavors/tick.rs":"0916ca3faef30b8cc591137701c456d5fc5b5b49cb1edad1e3a80d35bae222bb","src/flavors/zero.rs":"7458eb0ece475dc5093b4f2cde13f6de57e4f70291258850de4fa3c951c8f594","src/lib.rs":"3a65706d4124844ffc4c8cb1f8cc779631ec94f449f85cbb68364ad3619404f1","src/select.rs":"966fb1abb05f900b84a00ff2bd99b4934aafc793d9083ad4f31c551cc9f6aa5f","src/select_macro.rs":"283acd04870356b0c4d3d4046c5070638b562c9ffb8fa29c1a5b90a2509bf3af","src/utils.rs":"d99c66d668c2e232b488f0121826ceac07a875c9ad48bc053e138320d2b20cf4","src/waker.rs":"6839108d1c9357b3c0c1c162c8b4633ff5ac4f756e95e677ac1293e7df942635","tests/after.rs":"0154a8e152880db17a20514ecdd49dabc361d3629858d119b9746b5e932c780c","tests/array.rs":"a57ae6264e676f573d7adb5c4b024994e98bc6811352516adb3444f880f7125e","tests/golang.rs":"7b2ef219ba8a21841c133512f3a540f8279a2458304e9bbed7da81d6091ecd82","tests/iter.rs":"25dc02135bbae9d47a30f9047661648e66bdc134e40ba78bc2fbacbb8b3819bc","tests/list.rs":"3d1a4ae23bb6b4767242b8109a8efda26f1d3b28c0f90da3368f8eb9ca0eee37","tests/mpsc.rs":"d1e185c6290240132a34aa91221271225959f8652d7fc4ceb546ee9712361176","tests/never.rs":"ee40c4fc4dd5af4983fae8de6927f52b81174d222c162f745b26c4a6c7108e4f","tests/ready.rs":"3b4c42d01b01f27e994f6a147e6f56187c23679408f216e180211fdc4f9805cc","tests/same_channel.rs":"2bab761443671e841e1b2476bd8082d75533a2f6be7946f5dbcee67cdc82dccb","tests/select.rs":"ce12a8e0284fb9ccf6c1543bec309d9054193e6d942663aed19aa8499ef69c43","tests/select_macro.rs":"597d526fbd021ce70619d9172c931439f778ee3034ec1479aea461b65971a81a","tests/thread_locals.rs":"25ab70a8dcd8a0da9173e5476e17dcc8916caa5b68207d9c403655deaa8e8f4a","tests/tick.rs":"5f697bd14c48505d932e82065b5302ef668e1cc19cac18e8ac22e0c83c221c1d","tests/zero.rs":"9c5af802d5efb2c711f8242b8905ed29cc2601e48dbd95e41c7e6fbfe2918398"},"package":"a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"} \ No newline at end of file
diff --git a/vendor/crossbeam-channel/CHANGELOG.md b/vendor/crossbeam-channel/CHANGELOG.md
index f0d11e60c..6a405ee73 100644
--- a/vendor/crossbeam-channel/CHANGELOG.md
+++ b/vendor/crossbeam-channel/CHANGELOG.md
@@ -1,13 +1,29 @@
+# Version 0.5.8
+
+- Fix race condition in unbounded channel. (#972)
+
+# Version 0.5.7
+
+**Note:** This release has been yanked due to bug fixed in 0.5.8.
+
+- Improve handling of very large timeout. (#953)
+
# Version 0.5.6
+**Note:** This release has been yanked due to bug fixed in 0.5.8.
+
- Bump the minimum supported Rust version to 1.38. (#877)
# Version 0.5.5
+**Note:** This release has been yanked due to bug fixed in 0.5.8.
+
- Replace Spinlock with Mutex. (#835)
# Version 0.5.4
+**Note:** This release has been yanked due to bug fixed in 0.5.8.
+
- Workaround a bug in upstream related to TLS access on AArch64 Linux. (#802)
# Version 0.5.3
@@ -24,6 +40,8 @@
# Version 0.5.1
+**Note:** This release has been yanked due to bug fixed in 0.5.8.
+
- Fix memory leak in unbounded channel. (#669)
# Version 0.5.0
diff --git a/vendor/crossbeam-channel/Cargo.lock b/vendor/crossbeam-channel/Cargo.lock
index e40f83650..27caf373f 100644
--- a/vendor/crossbeam-channel/Cargo.lock
+++ b/vendor/crossbeam-channel/Cargo.lock
@@ -10,7 +10,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "crossbeam-channel"
-version = "0.5.6"
+version = "0.5.8"
dependencies = [
"cfg-if",
"crossbeam-utils",
@@ -21,19 +21,18 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
-version = "0.8.11"
+version = "0.8.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc"
+checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
dependencies = [
"cfg-if",
- "once_cell",
]
[[package]]
name = "getrandom"
-version = "0.2.7"
+version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
+checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
dependencies = [
"cfg-if",
"libc",
@@ -42,40 +41,34 @@ dependencies = [
[[package]]
name = "hermit-abi"
-version = "0.1.19"
+version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
+checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]]
name = "libc"
-version = "0.2.126"
+version = "0.2.141"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
+checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
[[package]]
name = "num_cpus"
-version = "1.13.1"
+version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
+checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
dependencies = [
"hermit-abi",
"libc",
]
[[package]]
-name = "once_cell"
-version = "1.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
-
-[[package]]
name = "ppv-lite86"
-version = "0.2.16"
+version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
+checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "rand"
@@ -100,18 +93,18 @@ dependencies = [
[[package]]
name = "rand_core"
-version = "0.6.3"
+version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom",
]
[[package]]
name = "signal-hook"
-version = "0.3.14"
+version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d"
+checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9"
dependencies = [
"libc",
"signal-hook-registry",
@@ -119,9 +112,9 @@ dependencies = [
[[package]]
name = "signal-hook-registry"
-version = "1.4.0"
+version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
+checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
dependencies = [
"libc",
]
diff --git a/vendor/crossbeam-channel/Cargo.toml b/vendor/crossbeam-channel/Cargo.toml
index 619fad423..6441fa4b8 100644
--- a/vendor/crossbeam-channel/Cargo.toml
+++ b/vendor/crossbeam-channel/Cargo.toml
@@ -13,7 +13,7 @@
edition = "2018"
rust-version = "1.38"
name = "crossbeam-channel"
-version = "0.5.6"
+version = "0.5.8"
description = "Multi-producer multi-consumer channels for message passing"
homepage = "https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-channel"
readme = "README.md"
diff --git a/vendor/crossbeam-channel/src/channel.rs b/vendor/crossbeam-channel/src/channel.rs
index 800fe6352..bd241156f 100644
--- a/vendor/crossbeam-channel/src/channel.rs
+++ b/vendor/crossbeam-channel/src/channel.rs
@@ -14,7 +14,6 @@ use crate::err::{
};
use crate::flavors;
use crate::select::{Operation, SelectHandle, Token};
-use crate::utils;
/// Creates a channel of unbounded capacity.
///
@@ -160,7 +159,7 @@ pub fn bounded<T>(cap: usize) -> (Sender<T>, Receiver<T>) {
/// let ms = |ms| Duration::from_millis(ms);
///
/// // Returns `true` if `a` and `b` are very close `Instant`s.
-/// let eq = |a, b| a + ms(50) > b && b + ms(50) > a;
+/// let eq = |a, b| a + ms(60) > b && b + ms(60) > a;
///
/// let start = Instant::now();
/// let r = after(ms(100));
@@ -172,8 +171,11 @@ pub fn bounded<T>(cap: usize) -> (Sender<T>, Receiver<T>) {
/// assert!(eq(Instant::now(), start + ms(500)));
/// ```
pub fn after(duration: Duration) -> Receiver<Instant> {
- Receiver {
- flavor: ReceiverFlavor::At(Arc::new(flavors::at::Channel::new_timeout(duration))),
+ match Instant::now().checked_add(duration) {
+ Some(deadline) => Receiver {
+ flavor: ReceiverFlavor::At(Arc::new(flavors::at::Channel::new_deadline(deadline))),
+ },
+ None => never(),
}
}
@@ -320,8 +322,14 @@ pub fn never<T>() -> Receiver<T> {
/// assert!(eq(Instant::now(), start + ms(700)));
/// ```
pub fn tick(duration: Duration) -> Receiver<Instant> {
- Receiver {
- flavor: ReceiverFlavor::Tick(Arc::new(flavors::tick::Channel::new(duration))),
+ match Instant::now().checked_add(duration) {
+ Some(delivery_time) => Receiver {
+ flavor: ReceiverFlavor::Tick(Arc::new(flavors::tick::Channel::new(
+ delivery_time,
+ duration,
+ ))),
+ },
+ None => never(),
}
}
@@ -474,7 +482,10 @@ impl<T> Sender<T> {
/// );
/// ```
pub fn send_timeout(&self, msg: T, timeout: Duration) -> Result<(), SendTimeoutError<T>> {
- self.send_deadline(msg, utils::convert_timeout_to_deadline(timeout))
+ match Instant::now().checked_add(timeout) {
+ Some(deadline) => self.send_deadline(msg, deadline),
+ None => self.send(msg).map_err(SendTimeoutError::from),
+ }
}
/// Waits for a message to be sent into the channel, but only until a given deadline.
@@ -864,7 +875,10 @@ impl<T> Receiver<T> {
/// );
/// ```
pub fn recv_timeout(&self, timeout: Duration) -> Result<T, RecvTimeoutError> {
- self.recv_deadline(utils::convert_timeout_to_deadline(timeout))
+ match Instant::now().checked_add(timeout) {
+ Some(deadline) => self.recv_deadline(deadline),
+ None => self.recv().map_err(RecvTimeoutError::from),
+ }
}
/// Waits for a message to be received from the channel, but only before a given deadline.
diff --git a/vendor/crossbeam-channel/src/flavors/at.rs b/vendor/crossbeam-channel/src/flavors/at.rs
index ca5ee60f5..515c4e33b 100644
--- a/vendor/crossbeam-channel/src/flavors/at.rs
+++ b/vendor/crossbeam-channel/src/flavors/at.rs
@@ -4,7 +4,7 @@
use std::sync::atomic::{AtomicBool, Ordering};
use std::thread;
-use std::time::{Duration, Instant};
+use std::time::Instant;
use crate::context::Context;
use crate::err::{RecvTimeoutError, TryRecvError};
@@ -32,11 +32,6 @@ impl Channel {
received: AtomicBool::new(false),
}
}
- /// Creates a channel that delivers a message after a certain duration of time.
- #[inline]
- pub(crate) fn new_timeout(dur: Duration) -> Self {
- Self::new_deadline(utils::convert_timeout_to_deadline(dur))
- }
/// Attempts to receive a message without blocking.
#[inline]
diff --git a/vendor/crossbeam-channel/src/flavors/list.rs b/vendor/crossbeam-channel/src/flavors/list.rs
index 6090b8d47..230edd8d2 100644
--- a/vendor/crossbeam-channel/src/flavors/list.rs
+++ b/vendor/crossbeam-channel/src/flavors/list.rs
@@ -584,6 +584,17 @@ impl<T> Channel<T> {
let mut head = self.head.index.load(Ordering::Acquire);
let mut block = self.head.block.load(Ordering::Acquire);
+ // If we're going to be dropping messages we need to synchronize with initialization
+ if head >> SHIFT != tail >> SHIFT {
+ // The block can be null here only if a sender is in the process of initializing the
+ // channel while another sender managed to send a message by inserting it into the
+ // semi-initialized channel and advanced the tail.
+ // In that case, just wait until it gets initialized.
+ while block.is_null() {
+ backoff.snooze();
+ block = self.head.block.load(Ordering::Acquire);
+ }
+ }
unsafe {
// Drop all messages between head and tail and deallocate the heap-allocated blocks.
while head >> SHIFT != tail >> SHIFT {
diff --git a/vendor/crossbeam-channel/src/flavors/tick.rs b/vendor/crossbeam-channel/src/flavors/tick.rs
index 4201b6eb0..d38f6a594 100644
--- a/vendor/crossbeam-channel/src/flavors/tick.rs
+++ b/vendor/crossbeam-channel/src/flavors/tick.rs
@@ -10,7 +10,6 @@ use crossbeam_utils::atomic::AtomicCell;
use crate::context::Context;
use crate::err::{RecvTimeoutError, TryRecvError};
use crate::select::{Operation, SelectHandle, Token};
-use crate::utils;
/// Result of a receive operation.
pub(crate) type TickToken = Option<Instant>;
@@ -27,9 +26,9 @@ pub(crate) struct Channel {
impl Channel {
/// Creates a channel that delivers messages periodically.
#[inline]
- pub(crate) fn new(dur: Duration) -> Self {
+ pub(crate) fn new(delivery_time: Instant, dur: Duration) -> Self {
Channel {
- delivery_time: AtomicCell::new(utils::convert_timeout_to_deadline(dur)),
+ delivery_time: AtomicCell::new(delivery_time),
duration: dur,
}
}
diff --git a/vendor/crossbeam-channel/src/select.rs b/vendor/crossbeam-channel/src/select.rs
index 57d67a3a1..3eb0b97c8 100644
--- a/vendor/crossbeam-channel/src/select.rs
+++ b/vendor/crossbeam-channel/src/select.rs
@@ -487,7 +487,10 @@ pub fn select_timeout<'a>(
handles: &mut [(&'a dyn SelectHandle, usize, *const u8)],
timeout: Duration,
) -> Result<SelectedOperation<'a>, SelectTimeoutError> {
- select_deadline(handles, utils::convert_timeout_to_deadline(timeout))
+ match Instant::now().checked_add(timeout) {
+ Some(deadline) => select_deadline(handles, deadline),
+ None => Ok(select(handles)),
+ }
}
/// Blocks until a given deadline, or until one of the operations becomes ready and selects it.
@@ -1045,7 +1048,10 @@ impl<'a> Select<'a> {
/// }
/// ```
pub fn ready_timeout(&mut self, timeout: Duration) -> Result<usize, ReadyTimeoutError> {
- self.ready_deadline(utils::convert_timeout_to_deadline(timeout))
+ match Instant::now().checked_add(timeout) {
+ Some(deadline) => self.ready_deadline(deadline),
+ None => Ok(self.ready()),
+ }
}
/// Blocks until a given deadline, or until one of the operations becomes ready.
diff --git a/vendor/crossbeam-channel/src/utils.rs b/vendor/crossbeam-channel/src/utils.rs
index 9f14c8e65..f623f2708 100644
--- a/vendor/crossbeam-channel/src/utils.rs
+++ b/vendor/crossbeam-channel/src/utils.rs
@@ -56,11 +56,3 @@ pub(crate) fn sleep_until(deadline: Option<Instant>) {
}
}
}
-
-// https://github.com/crossbeam-rs/crossbeam/issues/795
-pub(crate) fn convert_timeout_to_deadline(timeout: Duration) -> Instant {
- match Instant::now().checked_add(timeout) {
- Some(deadline) => deadline,
- None => Instant::now() + Duration::from_secs(86400 * 365 * 30),
- }
-}
diff --git a/vendor/crossbeam-channel/tests/golang.rs b/vendor/crossbeam-channel/tests/golang.rs
index 8050716c6..41149f485 100644
--- a/vendor/crossbeam-channel/tests/golang.rs
+++ b/vendor/crossbeam-channel/tests/golang.rs
@@ -9,7 +9,7 @@
//! - https://golang.org/LICENSE
//! - https://golang.org/PATENTS
-#![allow(clippy::mutex_atomic, clippy::redundant_clone)]
+#![allow(clippy::redundant_clone)]
use std::alloc::{GlobalAlloc, Layout, System};
use std::any::Any;
diff --git a/vendor/crossbeam-channel/tests/ready.rs b/vendor/crossbeam-channel/tests/ready.rs
index d8dd6ceb5..6e3fb2b64 100644
--- a/vendor/crossbeam-channel/tests/ready.rs
+++ b/vendor/crossbeam-channel/tests/ready.rs
@@ -229,6 +229,7 @@ fn default_when_disconnected() {
}
#[test]
+#[cfg_attr(miri, ignore)] // this test makes timing assumptions, but Miri is so slow it violates them
fn default_only() {
let start = Instant::now();