We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code taken from #106 (webdavfs.rs):
#[derive(Clone, Copy)] enum RuntimeType { Basic, ThreadPool, } impl RuntimeType { fn get() -> Self { static RUNTIME_TYPE: OnceLock<RuntimeType> = OnceLock::new(); *RUNTIME_TYPE.get_or_init(|| { let dbg = format!("{:?}", tokio::runtime::Handle::current()); if dbg.contains("ThreadPool") { Self::ThreadPool } else { Self::Basic } }) } } // Run some code via block_in_place() or spawn_blocking(). async fn blocking<F, R>(func: F) -> R where F: FnOnce() -> R + Send + 'static, R: Send + 'static, { match RuntimeType::get() { RuntimeType::Basic => tokio::task::spawn_blocking(func).await.unwrap(), RuntimeType::ThreadPool => tokio::task::block_in_place(func), } }
The text was updated successfully, but these errors were encountered:
don't know why we forgot about this, but in fact this was the key to our webdav problem... Is now solved using spawn_blocking...
spawn_blocking
Sorry, something went wrong.
No branches or pull requests
Code taken from #106 (webdavfs.rs):
The text was updated successfully, but these errors were encountered: