Add spawn_blocking to SubsystemContext (#1570)

* subsystem: add spawn_blocking to SubsystemContext

* candidate-validation: use spawn_blocking for exhaustive tasks
This commit is contained in:
Andronik Ordian
2020-08-17 14:26:32 +02:00
committed by GitHub
parent cf7133cbcf
commit ab1a513265
4 changed files with 42 additions and 2 deletions
+7
View File
@@ -178,6 +178,13 @@ pub trait SubsystemContext: Send + 'static {
/// Spawn a child task on the executor.
async fn spawn(&mut self, name: &'static str, s: Pin<Box<dyn Future<Output = ()> + Send>>) -> SubsystemResult<()>;
/// Spawn a blocking child task on the executor's dedicated thread pool.
async fn spawn_blocking(
&mut self,
name: &'static str,
s: Pin<Box<dyn Future<Output = ()> + Send>>,
) -> SubsystemResult<()>;
/// Send a direct message to some other `Subsystem`, routed based on message type.
async fn send_message(&mut self, msg: AllMessages) -> SubsystemResult<()>;