mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
fix: receive and return a runtime handle
This commit is contained in:
parent
4ec99bab36
commit
6fe47ff682
2 changed files with 3 additions and 3 deletions
|
@ -75,7 +75,7 @@ pub trait Controller<T : Sized + Send + Sync> : Sized + Send + Sync {
|
|||
/// important for proper cleanup
|
||||
fn callback<F>(
|
||||
self: &Arc<Self>,
|
||||
rt: &tokio::runtime::Runtime,
|
||||
rt: &tokio::runtime::Handle,
|
||||
mut stop: tokio::sync::mpsc::UnboundedReceiver<()>,
|
||||
mut cb: F
|
||||
) where
|
||||
|
|
|
@ -127,7 +127,7 @@ pub mod a_sync {
|
|||
pub mod sync {
|
||||
use std::sync::{Mutex, Arc};
|
||||
|
||||
use tokio::runtime::Runtime;
|
||||
use tokio::runtime::{Runtime, Handle};
|
||||
|
||||
use crate::{
|
||||
client::Client, Error,
|
||||
|
@ -166,7 +166,7 @@ pub mod sync {
|
|||
}
|
||||
|
||||
/// return a reference to contained tokio runtime, to spawn tasks on
|
||||
pub fn rt(&self) -> &Runtime { &self.runtime }
|
||||
pub fn rt(&self) -> &Handle { &self.runtime.handle() }
|
||||
|
||||
/// connect and store a client session, threadsafe and sync version of [crate::Client::new]
|
||||
pub fn connect(&self, addr: &str) -> Result<(), Error> {
|
||||
|
|
Loading…
Reference in a new issue