-
Notifications
You must be signed in to change notification settings - Fork 299
Open
Description
Hi,
I initialize runtime by calling a rust method that inits runtime and puts it into static OnceLock:
static TOKIO_RUNTIME: OnceLock<Runtime> = OnceLock::new();
/// Initialize tokio runtime once before interacting with nym-vpn-lib.
/// Repeat calls do nothing.
#[allow(non_snake_case)]
#[uniffi::export]
pub fn initializeTokioRuntime() {
let _rt = TOKIO_RUNTIME.get_or_init(|| {
tokio::runtime::Builder::new_multi_thread()
.worker_threads(10)
.enable_all()
.build()
.expect("failed to initialize tokio runtime")
});
}However some of the calls result in:
rustPanic("there is no reactor running, must be called from the context of a Tokio 1.x runtime")
This impacts our application. After migrating to uniffi objects and async_runtime, nothing really works anymore. How can I share the same runtime across all threads in Swift?
It seems that the issue manifests itself particularly when using Swift actors which use cooperative queue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels