make ctx.spawn blocking (#3337)

* make spawn sync

* improve error type
This commit is contained in:
Andronik Ordian
2021-06-22 03:43:40 +02:00
committed by GitHub
parent 9fa5d28e0b
commit ffc6f7c731
16 changed files with 27 additions and 80 deletions
@@ -224,7 +224,7 @@ impl<M: Send + 'static, S: SpawnNamed + Send + 'static> SubsystemContext
.ok_or_else(|| SubsystemError::Context("Receiving end closed".to_owned()))
}
async fn spawn(
fn spawn(
&mut self,
name: &'static str,
s: Pin<Box<dyn Future<Output = ()> + Send>>,
@@ -233,7 +233,7 @@ impl<M: Send + 'static, S: SpawnNamed + Send + 'static> SubsystemContext
Ok(())
}
async fn spawn_blocking(&mut self, name: &'static str, s: Pin<Box<dyn Future<Output = ()> + Send>>)
fn spawn_blocking(&mut self, name: &'static str, s: Pin<Box<dyn Future<Output = ()> + Send>>)
-> SubsystemResult<()>
{
self.spawn.spawn_blocking(name, s);