Deactivate tokio runtime respawning on interrupt
This commit is contained in:
@@ -5269,16 +5269,22 @@ impl Machine {
|
|||||||
self.machine_st.throw_interrupt_exception();
|
self.machine_st.throw_interrupt_exception();
|
||||||
self.machine_st.backtrack();
|
self.machine_st.backtrack();
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
// We have extracted controll over the Tokio runtime to the calling context for enabling library use case
|
||||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
// (see https://github.com/mthom/scryer-prolog/pull/1880)
|
||||||
#[cfg(target_arch = "wasm32")]
|
// So we only have access to a runtime handle in here and can't shut it down.
|
||||||
let runtime = tokio::runtime::Builder::new_current_thread()
|
// Since I'm not aware of the consequences of deactivating this new code which came in while PR 1880
|
||||||
.enable_all()
|
// was not merged, I'm only deactivating it for now.
|
||||||
.build()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let old_runtime = std::mem::replace(&mut self.runtime, runtime);
|
//#[cfg(not(target_arch = "wasm32"))]
|
||||||
old_runtime.shutdown_background();
|
//let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||||
|
//#[cfg(target_arch = "wasm32")]
|
||||||
|
//let runtime = tokio::runtime::Builder::new_current_thread()
|
||||||
|
// .enable_all()
|
||||||
|
// .build()
|
||||||
|
// .unwrap();
|
||||||
|
|
||||||
|
//let old_runtime = tokio::runtime::Handle::current();
|
||||||
|
//old_runtime.shutdown_background();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_) => unreachable!(),
|
Err(_) => unreachable!(),
|
||||||
|
|||||||
@@ -4615,8 +4615,13 @@ impl Machine {
|
|||||||
if interruption {
|
if interruption {
|
||||||
self.machine_st.throw_interrupt_exception();
|
self.machine_st.throw_interrupt_exception();
|
||||||
self.machine_st.backtrack();
|
self.machine_st.backtrack();
|
||||||
let old_runtime = std::mem::replace(&mut self.runtime, tokio::runtime::Runtime::new().unwrap());
|
// We have extracted controll over the Tokio runtime to the calling context for enabling library use case
|
||||||
old_runtime.shutdown_background();
|
// (see https://github.com/mthom/scryer-prolog/pull/1880)
|
||||||
|
// So we only have access to a runtime handle in here and can't shut it down.
|
||||||
|
// Since I'm not aware of the consequences of deactivating this new code which came in while PR 1880
|
||||||
|
// was not merged, I'm only deactivating it for now.
|
||||||
|
//let old_runtime = std::mem::replace(&mut self.runtime, tokio::runtime::Runtime::new().unwrap());
|
||||||
|
//old_runtime.shutdown_background();
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user