summaryrefslogtreecommitdiffstats
path: root/futures/src/backend/native/thread_pool.rs
diff options
context:
space:
mode:
Diffstat (limited to 'futures/src/backend/native/thread_pool.rs')
-rw-r--r--futures/src/backend/native/thread_pool.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/futures/src/backend/native/thread_pool.rs b/futures/src/backend/native/thread_pool.rs
new file mode 100644
index 00000000..6e791533
--- /dev/null
+++ b/futures/src/backend/native/thread_pool.rs
@@ -0,0 +1,16 @@
+//! A `ThreadPool` backend.
+use futures::Future;
+
+/// A thread pool executor for futures.
+#[cfg_attr(docsrs, doc(cfg(feature = "thread-pool")))]
+pub type ThreadPool = futures::executor::ThreadPool;
+
+impl crate::Executor for futures::executor::ThreadPool {
+ fn new() -> Result<Self, futures::io::Error> {
+ futures::executor::ThreadPool::new()
+ }
+
+ fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) {
+ self.spawn_ok(future);
+ }
+}