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

Function resume_separate_thread

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

Source from the content-addressed store, hash-verified

497#[tokio::test]
498#[cfg_attr(miri, ignore)]
499async fn resume_separate_thread() {
500 // This test will poll the following future on two threads. Simulating a
501 // trap requires accessing TLS info, so that should be preserved correctly.
502 execute_across_threads(async {
503 let mut store = async_store();
504 let module = Module::new(
505 store.engine(),
506 "
507 (module
508 (import \"\" \"\" (func))
509 (start 0)
510 )
511 ",
512 )
513 .unwrap();
514 let func = Func::wrap_async(&mut store, |_, _: ()| {
515 Box::new(async {
516 tokio::task::yield_now().await;
517 Err::<(), _>(format_err!("test"))
518 })
519 });
520 let result = Instance::new_async(&mut store, &module, &[func.into()]).await;
521 assert!(result.is_err());
522 })
523 .await;
524}
525
526#[tokio::test]
527#[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