Move trap handler initialization to per-Store (#1644)
Previously we initialized trap handling (signals/etc) once-per-instance but that's a bit too granular since we only need to do this as one-time per-program initialization. This moves the initialization to `Store` instead which means that we'll call this at least once per thread, which some platforms may need (none currently do, they all only need per-program initialization, but Fuchsia will need per-thread initialization).
This commit is contained in:
@@ -743,6 +743,13 @@ pub(crate) struct StoreInner {
|
||||
impl Store {
|
||||
/// Creates a new store to be associated with the given [`Engine`].
|
||||
pub fn new(engine: &Engine) -> Store {
|
||||
// Ensure that wasmtime_runtime's signal handlers are configured. Note
|
||||
// that at the `Store` level it means we should perform this
|
||||
// once-per-thread. Platforms like Unix, however, only require this
|
||||
// once-per-program. In any case this is safe to call many times and
|
||||
// each one that's not relevant just won't do anything.
|
||||
wasmtime_runtime::init_traps();
|
||||
|
||||
let isa = native::builder().finish(settings::Flags::new(engine.config.flags.clone()));
|
||||
let compiler = Compiler::new(
|
||||
isa,
|
||||
|
||||
Reference in New Issue
Block a user