1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-26 19:47:43 +02:00

add arbiter handle assoc fn (#274)

* add arbiter handle assoc fn
This commit is contained in:
Rob Ede
2021-02-06 22:27:56 +00:00
committed by GitHub
parent 7ee42b50b4
commit eb4d29e15e
3 changed files with 31 additions and 1 deletions

View File

@ -122,6 +122,28 @@ fn arbiter_spawn_fn_runs() {
arbiter.join().unwrap();
}
#[test]
fn arbiter_handle_spawn_fn_runs() {
let sys = System::new();
let (tx, rx) = channel::<u32>();
let arbiter = Arbiter::new();
let handle = arbiter.handle();
drop(arbiter);
handle.spawn_fn(move || {
tx.send(42).unwrap();
System::current().stop()
});
let num = rx.recv_timeout(Duration::from_secs(2)).unwrap();
assert_eq!(num, 42);
handle.stop();
sys.run().unwrap();
}
#[test]
fn arbiter_drop_no_panic_fn() {
let _ = System::new();