1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Per-thread WAMR execution environment setup.
//!
//! WAMR's hardware-bound-checking (enabled by default) installs per-thread
//! signal handlers, so every thread that instantiates or calls Wasm must first
//! call `wasm_runtime_init_thread_env`. The main thread is initialized by
//! `wasm_runtime_full_init`; any other thread (e.g. a `cargo test` worker) needs
//! this. We do it lazily via a thread-local guard that also tears the env down
//! when the thread exits.
use wamrx_sys as sys;
;
thread_local!
/// Ensures the current thread's WAMR execution environment is initialized.
///
/// Idempotent and cheap after the first call on a thread.
pub