Skip to content

Commit

Permalink
fix wasm builds
Browse files Browse the repository at this point in the history
  • Loading branch information
aspect committed Nov 18, 2023
1 parent abff3a1 commit 54e0e0b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ fn runtime() -> &'static Runtime {
}
}

fn try_runtime() -> Option<&'static Runtime> {
pub fn try_runtime() -> Option<&'static Runtime> {
unsafe { RUNTIME.as_ref() }
}

Expand Down Expand Up @@ -257,6 +257,7 @@ where
/// Gracefully halt the runtime runtime. This is used
/// to shutdown kaspad when the kaspa-ng process exit
/// is an inevitable eventuality.
#[cfg(not(target_arch = "wasm32"))]
pub fn halt() {
if try_runtime().is_some() {
let handle = tokio::spawn(async move { runtime().shutdown().await });
Expand All @@ -271,6 +272,7 @@ pub fn halt() {
/// if it takes too long. This is used in attempt to shutdown
/// kaspad if the kaspa-ng process panics, which can result
/// in a still functioning zombie child process on unix systems.
#[cfg(not(target_arch = "wasm32"))]
pub fn abort() {
const TIMEOUT: u128 = 5000;
let flag = Arc::new(AtomicBool::new(false));
Expand Down

0 comments on commit 54e0e0b

Please sign in to comment.