-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
When a bus is created with a buffer of 0, messages are successfully broadcast, but are never received. I'm not sure if you care about such a use case (I want to receive only messages being sent now, not messages that may have been sitting in the queue waiting for a reader), but if not it woudl be good to get a message/panic when creating such a bus. Code:
extern crate bus;
use bus::Bus;
use std::thread;
use std::time::Duration;
fn main() {
let mut bus = Bus::new(0);
let mut rx = bus.add_rx();
let t = thread::spawn(move || {
rx.recv().unwrap();
});
thread::sleep(Duration::from_millis(500));
println!("Sending");
bus.broadcast(());
println!("Sent, waiting on receive");
t.join().unwrap();
println!("Received and joined");
}
In this minimal example, the sent message is always printed, but the final received/joined message is not. Increasing the buffer to 1 makes it complete successfully.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels