1 //! Stack on top of the Bluetooth interface shim 2 //! 3 //! Helpers for dealing with the stack on top of the Bluetooth interface. 4 5 use std::sync::Arc; 6 use tokio::runtime::{Builder, Runtime}; 7 8 lazy_static! { 9 // Shared runtime for topshim handlers. All async tasks will get run by this 10 // runtime and this will properly serialize all spawned tasks. 11 pub static ref RUNTIME: Arc<Runtime> = Arc::new( 12 Builder::new_multi_thread() 13 .worker_threads(1) 14 .max_blocking_threads(1) 15 .enable_all() 16 .build() 17 .unwrap() 18 ); 19 } 20 get_runtime() -> Arc<Runtime>21pub fn get_runtime() -> Arc<Runtime> { 22 RUNTIME.clone() 23 } 24