added delay to test

This commit is contained in:
2025-06-14 22:37:52 -04:00
parent 98a90e1766
commit b2948d1872

View File

@@ -1,5 +1,6 @@
use std::sync::{Arc, Condvar, Mutex};
/// Operates similarly to the `oneshot` channel in tokio
pub struct ReturnChannel<T> {
value: Mutex<Option<T>>,
condvar: Condvar,
@@ -52,6 +53,7 @@ impl<T> ReturnChannelSender<T> {
#[cfg(test)]
mod test {
pub use super::*;
use std::time::Duration;
#[test]
fn test_channel_single_thread() {
@@ -69,6 +71,7 @@ mod test {
let (tx, rx) = ReturnChannel::new();
std::thread::spawn(|| {
std::thread::sleep(Duration::from_millis(500));
tx.send(42);
});