Just install the signal handler once

This commit is contained in:
Lachlan Sneff 2019-03-05 16:50:49 -08:00
parent f36aade2e5
commit 0e5d1172d6

View File

@ -15,6 +15,7 @@ use std::{
mem, mem,
ptr::{self, NonNull}, ptr::{self, NonNull},
slice, str, slice, str,
sync::Once,
}; };
use wasmer_runtime_core::{ use wasmer_runtime_core::{
backend::{FuncResolver, ProtectedCaller, Token, UserTrapper}, backend::{FuncResolver, ProtectedCaller, Token, UserTrapper},
@ -258,9 +259,11 @@ impl LLVMBackend {
) )
}; };
unsafe { static SIGNAL_HANDLER_INSTALLED: Once = Once::new();
SIGNAL_HANDLER_INSTALLED.call_once(|| unsafe {
crate::platform::install_signal_handler(); crate::platform::install_signal_handler();
} });
if res != LLVMResult::OK { if res != LLVMResult::OK {
panic!("failed to load object") panic!("failed to load object")