Skip to content

Commit 7ffa012

Browse files
committed
comment!
1 parent d58453a commit 7ffa012

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/runtime/block_on.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ where
4949
res
5050
}
5151

52+
/// This waker is used in the Context of block_on. If a Future executing in
53+
/// the block_on calls context.wake(), it sets this boolean state so that
54+
/// block_on's Future is polled again immediately, rather than waiting for
55+
/// an external (WASI pollable) event before polling again.
5256
struct RootWaker {
5357
wake: AtomicBool,
5458
}

src/runtime/reactor.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ mod test {
281281
let later = wasi::clocks::monotonic_clock::subscribe_duration(LONG_DURATION);
282282
let later = reactor.schedule(later);
283283
let mut polled_before = false;
284+
// This is basically futures_lite::future::yield_now, except with a boolean
285+
// `polled_before` so we can definitively observe what happened
284286
let wasi_independent_future = futures_lite::future::poll_fn(|cx| {
285287
if polled_before {
286288
std::task::Poll::Ready(true)

0 commit comments

Comments
 (0)