Explicitly name all spawned threads
The thread name is shown in debugger as well as panic messages and this patch makes it easier to follow a thread instead of looking through full backtrace, by naming all spawned threads according to their functioning.
This commit is contained in:
@@ -67,7 +67,10 @@ impl FlycheckHandle {
|
||||
) -> FlycheckHandle {
|
||||
let actor = FlycheckActor::new(id, sender, config, workspace_root);
|
||||
let (sender, receiver) = unbounded::<Restart>();
|
||||
let thread = jod_thread::spawn(move || actor.run(receiver));
|
||||
let thread = jod_thread::Builder::new()
|
||||
.name("FlycheckThread".to_owned())
|
||||
.spawn(move || actor.run(receiver))
|
||||
.expect("failed to spawn thread");
|
||||
FlycheckHandle { sender, thread }
|
||||
}
|
||||
|
||||
@@ -266,7 +269,10 @@ impl CargoHandle {
|
||||
let child_stdout = child.stdout.take().unwrap();
|
||||
let (sender, receiver) = unbounded();
|
||||
let actor = CargoActor::new(child_stdout, sender);
|
||||
let thread = jod_thread::spawn(move || actor.run());
|
||||
let thread = jod_thread::Builder::new()
|
||||
.name("CargoHandleThread".to_owned())
|
||||
.spawn(move || actor.run())
|
||||
.expect("failed to spawn thread");
|
||||
CargoHandle { child, thread, receiver }
|
||||
}
|
||||
fn join(mut self) -> io::Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user