MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / join

Method join

crates/wasmtime/src/runtime/component/concurrent.rs:4820–4848  ·  view source on GitHub ↗

Move this `Waitable` to the specified set (when `set` is `Some(_)`) or remove it from any set it may currently belong to (when `set` is `None`).

(&self, state: &mut ConcurrentState, set: Option<TableId<WaitableSet>>)

Source from the content-addressed store, hash-verified

4818 /// remove it from any set it may currently belong to (when `set` is
4819 /// `None`).
4820 fn join(&self, state: &mut ConcurrentState, set: Option<TableId<WaitableSet>>) -> Result<()> {
4821 log::trace!("waitable {self:?} join set {set:?}");
4822
4823 let old = mem::replace(&mut self.common(state)?.set, set);
4824
4825 if let Some(old) = old {
4826 match *self {
4827 Waitable::Host(id) => state.remove_child(id, old),
4828 Waitable::Guest(id) => state.remove_child(id, old),
4829 Waitable::Transmit(id) => state.remove_child(id, old),
4830 }?;
4831
4832 state.get_mut(old)?.ready.remove(self);
4833 }
4834
4835 if let Some(set) = set {
4836 match *self {
4837 Waitable::Host(id) => state.add_child(id, set),
4838 Waitable::Guest(id) => state.add_child(id, set),
4839 Waitable::Transmit(id) => state.add_child(id, set),
4840 }?;
4841
4842 if self.common(state)?.event.is_some() {
4843 self.mark_ready(state)?;
4844 }
4845 }
4846
4847 Ok(())
4848 }
4849
4850 /// Retrieve mutable access to the `WaitableCommon` for this `Waitable`.
4851 fn common<'a>(&self, state: &'a mut ConcurrentState) -> Result<&'a mut WaitableCommon> {

Callers 15

module_definitionMethod · 0.45
run_wastMethod · 0.45
run_directiveMethod · 0.45
run_fileMethod · 0.45
from_witxFunction · 0.45
parseMethod · 0.45
p2_api_read_onlyFunction · 0.45
mainFunction · 0.45
load_from_dirMethod · 0.45
load_from_dirMethod · 0.45
load_from_dirMethod · 0.45
load_from_dirMethod · 0.45

Calls 9

OkFunction · 0.85
commonMethod · 0.80
mark_readyMethod · 0.80
replaceFunction · 0.50
remove_childMethod · 0.45
removeMethod · 0.45
get_mutMethod · 0.45
add_childMethod · 0.45
is_someMethod · 0.45

Tested by 14

p2_api_read_onlyFunction · 0.36
are_artifacts_availableFunction · 0.36
are_artifacts_availableFunction · 0.36
artifacts_dirFunction · 0.36
are_artifacts_availableFunction · 0.36
atomic_wait_notifyFunction · 0.36
wait_with_timeoutFunction · 0.36
test_unload_engineFunction · 0.36
overrun_with_big_moduleFunction · 0.36
newMethod · 0.36
dropMethod · 0.36
test_http_middlewareFunction · 0.36