File: local_queue.rs

package info (click to toggle)
rust-async-executor 1.13.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 252 kB
  • sloc: makefile: 2; sh: 1
file content (24 lines) | stat: -rw-r--r-- 737 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use async_executor::Executor;
use futures_lite::{future, pin};

#[test]
fn two_queues() {
    future::block_on(async {
        // Create an executor with two runners.
        let ex = Executor::new();
        let (run1, run2) = (
            ex.run(future::pending::<()>()),
            ex.run(future::pending::<()>()),
        );
        let mut run1 = Box::pin(run1);
        pin!(run2);

        // Poll them both.
        assert!(future::poll_once(run1.as_mut()).await.is_none());
        assert!(future::poll_once(run2.as_mut()).await.is_none());

        // Drop the first one, which should leave the local queue in the `None` state.
        drop(run1);
        assert!(future::poll_once(run2.as_mut()).await.is_none());
    });
}