Skip to content

Commit e3c3f33

Browse files
author
Pat Hickey
authored
Merge pull request #138 from WebAssembly/pch/wit_deps_10_31
wit-deps update
2 parents 0f3f970 + 06e1a2f commit e3c3f33

File tree

4 files changed

+62
-31
lines changed

4 files changed

+62
-31
lines changed

imports.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,27 @@ at once.</p>
1818
<h4><a name="pollable"><code>resource pollable</code></a></h4>
1919
<hr />
2020
<h3>Functions</h3>
21-
<h4><a name="poll_list"><code>poll-list: func</code></a></h4>
21+
<h4><a name="method_pollable.ready"><code>[method]pollable.ready: func</code></a></h4>
22+
<p>Return the readiness of a pollable. This function never blocks.</p>
23+
<p>Returns <code>true</code> when the pollable is ready, and <code>false</code> otherwise.</p>
24+
<h5>Params</h5>
25+
<ul>
26+
<li><a name="method_pollable.ready.self"><code>self</code></a>: borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
27+
</ul>
28+
<h5>Return values</h5>
29+
<ul>
30+
<li><a name="method_pollable.ready.0"></a> <code>bool</code></li>
31+
</ul>
32+
<h4><a name="method_pollable.block"><code>[method]pollable.block: func</code></a></h4>
33+
<p><code>block</code> returns immediately if the pollable is ready, and otherwise
34+
blocks until ready.</p>
35+
<p>This function is equivalent to calling <code>poll.poll</code> on a list
36+
containing only this pollable.</p>
37+
<h5>Params</h5>
38+
<ul>
39+
<li><a name="method_pollable.block.self"><code>self</code></a>: borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
40+
</ul>
41+
<h4><a name="poll"><code>poll: func</code></a></h4>
2242
<p>Poll for completion on a set of pollables.</p>
2343
<p>This function takes a list of pollables, which identify I/O sources of
2444
interest, and waits until one or more of the events is ready for I/O.</p>
@@ -34,19 +54,11 @@ the pollables has an error, it is indicated by marking the source as
3454
being reaedy for I/O.</p>
3555
<h5>Params</h5>
3656
<ul>
37-
<li><a name="poll_list.in"><code>in</code></a>: list&lt;borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;&gt;</li>
57+
<li><a name="poll.in"><code>in</code></a>: list&lt;borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;&gt;</li>
3858
</ul>
3959
<h5>Return values</h5>
4060
<ul>
41-
<li><a name="poll_list.0"></a> list&lt;<code>u32</code>&gt;</li>
42-
</ul>
43-
<h4><a name="poll_one"><code>poll-one: func</code></a></h4>
44-
<p>Poll for completion on a single pollable.</p>
45-
<p>This function is similar to <a href="#poll_list"><code>poll-list</code></a>, but operates on only a single
46-
pollable. When it returns, the handle is ready for I/O.</p>
47-
<h5>Params</h5>
48-
<ul>
49-
<li><a name="poll_one.in"><code>in</code></a>: borrow&lt;<a href="#pollable"><a href="#pollable"><code>pollable</code></a></a>&gt;</li>
61+
<li><a name="poll.0"></a> list&lt;<code>u32</code>&gt;</li>
5062
</ul>
5163
<h2><a name="wasi:io_streams">Import interface wasi:io/streams</a></h2>
5264
<p>WASI I/O is an I/O abstraction API which is currently focused on providing

wit/deps.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[clocks]
22
url = "https://github.com/WebAssembly/wasi-clocks/archive/main.tar.gz"
3-
sha256 = "74844f8bf1d356bb44aab64a2f917d7a3bcb6d6924662d2e3909aeabda01bea6"
4-
sha512 = "ef21339a60a3f4a37eb48ab81b411c1f2ed11c9b23da04d1e384c07dd4cc75f1a433ce7b46201c693b7a59b51c73d888bc41c78ad204fe32d8a312a9f9a48eb0"
3+
sha256 = "8d6b9f7a8bf9466bdc68043c33e054878fdf09c1cc69c19c99eeadd3bb257a90"
4+
sha512 = "21b65d911930c4512bb3caa08459283fc70b1ccc5159313092334cffd6662fb92cfe90577b51829ef363e2d02530802c88f2a1f82db43964d1f8bff7ecbc794b"
55

66
[io]
77
url = "https://github.com/WebAssembly/wasi-io/archive/main.tar.gz"
8-
sha256 = "027671996ef6e3bedd160a6ca6631184cf68d7b36497225316c1726a5d0eb078"
9-
sha512 = "2a3fee2c5acc2091dec45a929ff3d857e75a1970fd64d2f3ce5faad2a0d5fb3df0ad8c5f09a97c1ade8c5986317993058d141a5922b19dfbdaf97041a9bde7aa"
8+
sha256 = "fb76f4449eea54d06b56fc6a7ca988da51bd84a54d2021cf18da67b5e2c7ebcf"
9+
sha512 = "c005e2a91522958a9537827a49ae344e1cb39d66e85492901a86bcc7e322ba8d0a7f1a02c9b9f840c123b4ad97e297355fac98d4822536d1426d1096dd1d73ac"

wit/deps/clocks/monotonic-clock.wit

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,34 @@
1111
interface monotonic-clock {
1212
use wasi:io/poll.{pollable};
1313

14-
/// A timestamp in nanoseconds.
14+
/// An instant in time, in nanoseconds. An instant is relative to an
15+
/// unspecified initial value, and can only be compared to instances from
16+
/// the same monotonic-clock.
1517
type instant = u64;
1618

19+
/// A duration of time, in nanoseconds.
20+
type duration = u64;
21+
1722
/// Read the current value of the clock.
1823
///
1924
/// The clock is monotonic, therefore calling this function repeatedly will
2025
/// produce a sequence of non-decreasing values.
2126
now: func() -> instant;
2227

23-
/// Query the resolution of the clock.
24-
resolution: func() -> instant;
28+
/// Query the resolution of the clock. Returns the duration of time
29+
/// corresponding to a clock tick.
30+
resolution: func() -> duration;
2531

26-
/// Create a `pollable` which will resolve once the specified time has been
27-
/// reached.
28-
subscribe: func(
32+
/// Create a `pollable` which will resolve once the specified instant
33+
/// occured.
34+
subscribe-instant: func(
2935
when: instant,
30-
absolute: bool
36+
) -> pollable;
37+
38+
/// Create a `pollable` which will resolve once the given duration has
39+
/// elapsed, starting at the time at which this function was called.
40+
/// occured.
41+
subscribe-duration: func(
42+
when: duration,
3143
) -> pollable;
3244
}

wit/deps/io/poll.wit

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,21 @@ package wasi:io;
33
/// A poll API intended to let users wait for I/O events on multiple handles
44
/// at once.
55
interface poll {
6-
/// A "pollable" handle.
7-
resource pollable;
6+
/// `pollable` epresents a single I/O event which may be ready, or not.
7+
resource pollable {
8+
9+
/// Return the readiness of a pollable. This function never blocks.
10+
///
11+
/// Returns `true` when the pollable is ready, and `false` otherwise.
12+
ready: func() -> bool;
13+
14+
/// `block` returns immediately if the pollable is ready, and otherwise
15+
/// blocks until ready.
16+
///
17+
/// This function is equivalent to calling `poll.poll` on a list
18+
/// containing only this pollable.
19+
block: func();
20+
}
821

922
/// Poll for completion on a set of pollables.
1023
///
@@ -24,11 +37,5 @@ interface poll {
2437
/// do any I/O so it doesn't fail. If any of the I/O sources identified by
2538
/// the pollables has an error, it is indicated by marking the source as
2639
/// being reaedy for I/O.
27-
poll-list: func(in: list<borrow<pollable>>) -> list<u32>;
28-
29-
/// Poll for completion on a single pollable.
30-
///
31-
/// This function is similar to `poll-list`, but operates on only a single
32-
/// pollable. When it returns, the handle is ready for I/O.
33-
poll-one: func(in: borrow<pollable>);
40+
poll: func(in: list<borrow<pollable>>) -> list<u32>;
3441
}

0 commit comments

Comments
 (0)