MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / wake_by_ref

Method wake_by_ref

crates/guest-rust/src/rt/async_support.rs:395–408  ·  view source on GitHub ↗
(self: &Arc<Self>)

Source from the content-addressed store, hash-verified

393 }
394
395 fn wake_by_ref(self: &Arc<Self>) {
396 match self.sleep_state.swap(SLEEP_STATE_WOKEN, Ordering::Relaxed) {
397 // If this future was currently being polled, or if someone else
398 // already woke it up, then there's nothing to do.
399 SLEEP_STATE_POLLING | SLEEP_STATE_WOKEN => {}
400
401 // If this future is sleeping, however, then this is a cross-task
402 // wakeup meaning that we need to write to its wakeup stream.
403 other => {
404 assert_eq!(other, SLEEP_STATE_SLEEPING);
405 self.inter_task_stream.wake();
406 }
407 }
408 }
409}
410
411const EVENT_NONE: u32 = 0;

Callers 2

fMethod · 0.80
pollMethod · 0.80

Calls 1

wakeMethod · 0.45

Tested by

no test coverage detected