-
Notifications
You must be signed in to change notification settings - Fork 72
Closed
Description
I created a demo project: https://github.com/kanarus/test-compio-timeout. The core part of this is:
for _ in 0..100 {
let x = timeout!(
std::time::Duration::from_secs(2),
heavy_task(std::time::Duration::from_secs(3))
).await;
let y = my_timeout(
sleep!(std::time::Duration::from_secs(2)),
heavy_task(std::time::Duration::from_secs(3))
).await;
println!("{x:?}, {y:?}");
}This demo provides compio and monoio feature flag to easily switch runtimes, and
my_timeoutis a custom, generictimeoutimplementation.sleep!calls{compio or monoio}::time::sleep(~).awaitbased on selected feature.timeout!calls{compio or monoio}::time::timeout(~).await.ok()based on selected feature.
My environment
uname -a
Linux ThinkPad 6.8.0-79-generic #79~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 15 16:54:53 UTC 2 x86_64 x86_64 x86_64 GNU/LinuxExpected behavior (by cargo run --features monoio)
- print
None, Noneevery 4 seconds ( 2 secs + 2 secs ).
None, None
None, None
None, None
None, None
None, None
None, None
None, None
None, None
None, None
None, None
compio behavior (by cargo run --features compio)
- print lines in irregular interval.
- printed content is flaky.
- is cancellation or something buggy?
None, Some("done")
Some("done"), Some("done")
Some("done"), None
Some("done"), Some("done")
None, None
None, Some("done")
None, None
Some("done"), Some("done")
Some("done"), Some("done")
Some("done"), Some("done")
Metadata
Metadata
Assignees
Labels
No labels