Name all the tasks! (#6726)

* Remove any implementation of `Spawn` or `Executor` from our task executors

* Fix compilation

* Rename `SpawnBlockingExecutor`

* Update primitives/core/src/traits.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Fix tests

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Bastian Köcher
2020-07-26 14:56:17 +02:00
committed by GitHub
parent 2ec131142b
commit 9310f15ac2
43 changed files with 280 additions and 280 deletions
+4 -4
View File
@@ -359,16 +359,16 @@ macro_rules! wasm_export_functions {
};
}
/// An executor that supports spawning blocking futures in tests.
/// A task executor that can be used in tests.
///
/// Internally this just wraps a `ThreadPool` with a pool size of `8`. This
/// should ensure that we have enough threads in tests for spawning blocking futures.
#[cfg(feature = "std")]
#[derive(Clone)]
pub struct SpawnBlockingExecutor(futures::executor::ThreadPool);
pub struct TaskExecutor(futures::executor::ThreadPool);
#[cfg(feature = "std")]
impl SpawnBlockingExecutor {
impl TaskExecutor {
/// Create a new instance of `Self`.
pub fn new() -> Self {
let mut builder = futures::executor::ThreadPoolBuilder::new();
@@ -377,7 +377,7 @@ impl SpawnBlockingExecutor {
}
#[cfg(feature = "std")]
impl crate::traits::SpawnNamed for SpawnBlockingExecutor {
impl crate::traits::SpawnNamed for TaskExecutor {
fn spawn_blocking(&self, _: &'static str, future: futures::future::BoxFuture<'static, ()>) {
self.0.spawn_ok(future);
}