Skip to content

How to sleep without blocking the main thread in async tests #271

@GordianDziwis

Description

@GordianDziwis

// TODO: how do sleep without blocking the main thread?
// sleep(timeout / 2);
//
// assert_eq!(rx.try_recv().unwrap(), ());
//
// sleep(timeout / 2);
//
// for _ in 0..10 {
// assert_eq!(rx.try_recv().unwrap(), ());
// assert_eq!(rx.try_recv().unwrap_err(), mpsc::TryRecvError::Empty);

This worked for me:

    api::command("sleep 2")?;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions