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

Function resume_separate_thread2

tests/all/async_functions.rs:528–556  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

526#[tokio::test]
527#[cfg_attr(miri, ignore)]
528async fn resume_separate_thread2() {
529 // This test will poll the following future on two threads. Catching a
530 // signal requires looking up TLS information to determine whether it's a
531 // trap to handle or not, so that must be preserved correctly across threads.
532 execute_across_threads(async {
533 let mut store = async_store();
534 let module = Module::new(
535 store.engine(),
536 "
537 (module
538 (import \"\" \"\" (func))
539 (func $start
540 call 0
541 unreachable)
542 (start $start)
543 )
544 ",
545 )
546 .unwrap();
547 let func = Func::wrap_async(&mut store, |_, _: ()| {
548 Box::new(async {
549 tokio::task::yield_now().await;
550 })
551 });
552 let result = Instance::new_async(&mut store, &module, &[func.into()]).await;
553 assert!(result.is_err());
554 })
555 .await;
556}
557
558#[tokio::test]
559#[cfg_attr(miri, ignore)]

Callers

nothing calls this directly

Calls 6

execute_across_threadsFunction · 0.85
yield_nowFunction · 0.85
async_storeFunction · 0.70
newFunction · 0.50
unwrapMethod · 0.45
engineMethod · 0.45

Tested by

no test coverage detected