()
| 620 | #[tokio::test] |
| 621 | #[cfg_attr(miri, ignore)] |
| 622 | async fn resume_separate_thread_tls() { |
| 623 | static COUNTER: AtomicUsize = AtomicUsize::new(0); |
| 624 | |
| 625 | struct IncOnDrop; |
| 626 | impl Drop for IncOnDrop { |
| 627 | fn drop(&mut self) { |
| 628 | COUNTER.fetch_add(1, Ordering::SeqCst); |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | thread_local!(static FOO: IncOnDrop = IncOnDrop); |
| 633 | |
| 634 | // This test will poll the following future on two threads. |
| 635 | // We verify that TLS destructors are run correctly. |
| 636 | execute_across_threads(async move { |
| 637 | let mut store = async_store(); |
| 638 | let module = Module::new( |
| 639 | store.engine(), |
| 640 | " |
| 641 | (module |
| 642 | (import \"\" \"\" (func)) |
| 643 | (start 0) |
| 644 | ) |
| 645 | ", |
| 646 | ) |
| 647 | .unwrap(); |
| 648 | let func = Func::wrap_async(&mut store, |_, _: ()| { |
| 649 | Box::new(async { |
| 650 | tokio::task::yield_now().await; |
| 651 | FOO.with(|_f| {}); |
| 652 | Err::<(), _>(format_err!("test")) |
| 653 | }) |
| 654 | }); |
| 655 | let result = Instance::new_async(&mut store, &module, &[func.into()]).await; |
| 656 | assert!(result.is_err()); |
| 657 | }) |
| 658 | .await; |
| 659 | |
| 660 | assert_eq!(COUNTER.load(Ordering::SeqCst), 1); |
| 661 | } |
| 662 | |
| 663 | #[tokio::test] |
| 664 | #[cfg_attr(miri, ignore)] |
nothing calls this directly
no test coverage detected