create parallel tasks extension (#5249)

This commit is contained in:
Nikolay Volf
2020-03-16 08:30:39 -07:00
committed by GitHub
parent 418b7b8bc2
commit 372745705d
25 changed files with 189 additions and 26 deletions
@@ -26,6 +26,7 @@ use futures::{
compat::*,
task::{Spawn, FutureObj, SpawnError},
};
use sc_client_api::CloneableSpawn;
/// Type alias for service task executor (usually runtime).
pub type ServiceTaskExecutor = Arc<dyn Fn(Pin<Box<dyn Future<Output = ()> + Send>>) + Send + Sync>;
@@ -118,6 +119,12 @@ impl Spawn for SpawnTaskHandle {
}
}
impl sc_client_api::CloneableSpawn for SpawnTaskHandle {
fn clone(&self) -> Box<dyn CloneableSpawn> {
Box::new(Clone::clone(self))
}
}
type Boxed01Future01 = Box<dyn futures01::Future<Item = (), Error = ()> + Send + 'static>;
impl futures01::future::Executor<Boxed01Future01> for SpawnTaskHandle {