summaryrefslogtreecommitdiffstats
path: root/tokio/src/runtime/blocking
diff options
context:
space:
mode:
authorwspsxing <biluohc@qq.com>2020-08-24 21:14:20 +0800
committerGitHub <noreply@github.com>2020-08-24 15:14:20 +0200
commit4e12299826a2e3b1f40272fa6657b58ff31ef44f (patch)
tree3db3728ae84048f26e4e8b5639c085d6d6215898 /tokio/src/runtime/blocking
parent9d58b70151d7dbb66139125520d383401396eb98 (diff)
runtime: add thread_name_fn method to runtime::Builder (#1921)
Fixes: #1907
Diffstat (limited to 'tokio/src/runtime/blocking')
-rw-r--r--tokio/src/runtime/blocking/pool.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/tokio/src/runtime/blocking/pool.rs b/tokio/src/runtime/blocking/pool.rs
index c5d464c8..5ad5f5f8 100644
--- a/tokio/src/runtime/blocking/pool.rs
+++ b/tokio/src/runtime/blocking/pool.rs
@@ -5,6 +5,7 @@ use crate::loom::thread;
use crate::runtime::blocking::schedule::NoopSchedule;
use crate::runtime::blocking::shutdown;
use crate::runtime::blocking::task::BlockingTask;
+use crate::runtime::builder::ThreadNameFn;
use crate::runtime::task::{self, JoinHandle};
use crate::runtime::{Builder, Callback, Handle};
@@ -32,7 +33,7 @@ struct Inner {
condvar: Condvar,
/// Spawned threads use this name
- thread_name: String,
+ thread_name: ThreadNameFn,
/// Spawned thread stack size
stack_size: Option<usize>,
@@ -214,7 +215,7 @@ impl Spawner {
rt: &Handle,
worker_id: usize,
) -> thread::JoinHandle<()> {
- let mut builder = thread::Builder::new().name(self.inner.thread_name.clone());
+ let mut builder = thread::Builder::new().name((self.inner.thread_name)());
if let Some(stack_size) = self.inner.stack_size {
builder = builder.stack_size(stack_size);