forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename poll-list to poll, poll-one to pollable.block, and introduce p…
…ollable.ready (bytecodealliance#7427) * update wasi:io/poll wit to WebAssembly/wasi-io#54 * put version in wit package name * implement changes to the wits * move contents of Host::poll_one to HostPollable::block * rename Host::poll_list to Host::poll, * implement HostPollable::ready, using futures::future::poll_immediate * wit: fix reference to poll-list * wasi-http wit: fix reference to poll-list * clocks implementation: ready returns immediately if deadline has past this is an optimization, but what it really allows us to do is assert pollable.ready() for a subscribe_duration(0) is ready immediately. * component adapter: rename poll-list to poll * test-programs: renames to poll functions test-programs/src/bin/preview2_sleep.rs in particular now asserts ready() on a subscribe_duration(0) and a subscribe_instant(now() - 1), so we have test coverage for ready as well now * code review Co-authored-by: Alex Crichton <alex@alexcrichton.com> --------- Co-authored-by: Alex Crichton <alex@alexcrichton.com>
- Loading branch information
1 parent
83a33b0
commit ddffc7e
Showing
17 changed files
with
103 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
crates/test-programs/src/bin/preview2_stream_pollable_correct.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
use test_programs::wasi::cli::stdin; | ||
use test_programs::wasi::io::poll; | ||
use test_programs::wasi::io::streams; | ||
|
||
fn main() { | ||
let stdin: streams::InputStream = stdin::get_stdin(); | ||
let stdin_pollable = stdin.subscribe(); | ||
let ready = poll::poll_list(&[&stdin_pollable]); | ||
assert_eq!(ready, &[0]); | ||
stdin_pollable.block(); | ||
assert!(stdin_pollable.ready(), "after blocking, pollable is ready"); | ||
drop(stdin_pollable); | ||
drop(stdin); | ||
} |
4 changes: 1 addition & 3 deletions
4
crates/test-programs/src/bin/preview2_stream_pollable_traps.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
use test_programs::wasi::cli::stdin; | ||
use test_programs::wasi::io::poll; | ||
use test_programs::wasi::io::streams; | ||
|
||
fn main() { | ||
let stdin: streams::InputStream = stdin::get_stdin(); | ||
let stdin_pollable = stdin.subscribe(); | ||
let ready = poll::poll_list(&[&stdin_pollable]); | ||
assert_eq!(ready, &[0]); | ||
stdin_pollable.block(); | ||
drop(stdin); | ||
unreachable!("execution should have trapped in line above when stream dropped before pollable"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.