give each thread a unique name

This commit is contained in:
Marcel Märtens 2021-03-22 11:06:15 +01:00
parent f9720b9767
commit a945d83ac7
2 changed files with 20 additions and 10 deletions

View file

@ -912,9 +912,12 @@ impl Stream {
let (tx, rx) = trigger(); let (tx, rx) = trigger();
// Clone the handle for passing into worker thread. // Clone the handle for passing into worker thread.
let stream = inner.clone(); let stream = inner.clone();
let thread = thread::spawn(move || { let thread = thread::Builder::new()
input_stream_worker(rx, &*stream, &mut data_callback, &mut error_callback); .name("cpal_alsa_in".to_owned())
}); .spawn(move || {
input_stream_worker(rx, &*stream, &mut data_callback, &mut error_callback);
})
.unwrap();
Stream { Stream {
thread: Some(thread), thread: Some(thread),
inner, inner,
@ -934,9 +937,12 @@ impl Stream {
let (tx, rx) = trigger(); let (tx, rx) = trigger();
// Clone the handle for passing into worker thread. // Clone the handle for passing into worker thread.
let stream = inner.clone(); let stream = inner.clone();
let thread = thread::spawn(move || { let thread = thread::Builder::new()
output_stream_worker(rx, &*stream, &mut data_callback, &mut error_callback); .name("cpal_alsa_out".to_owned())
}); .spawn(move || {
output_stream_worker(rx, &*stream, &mut data_callback, &mut error_callback);
})
.unwrap();
Stream { Stream {
thread: Some(thread), thread: Some(thread),
inner, inner,

View file

@ -100,8 +100,10 @@ impl Stream {
commands: rx, commands: rx,
}; };
let thread = let thread = thread::Builder::new()
thread::spawn(move || run_input(run_context, &mut data_callback, &mut error_callback)); .name("cpal_wasapi_in".to_owned())
.spawn(move || run_input(run_context, &mut data_callback, &mut error_callback))
.unwrap();
Stream { Stream {
thread: Some(thread), thread: Some(thread),
@ -129,8 +131,10 @@ impl Stream {
commands: rx, commands: rx,
}; };
let thread = let thread = thread::Builder::new()
thread::spawn(move || run_output(run_context, &mut data_callback, &mut error_callback)); .name("cpal_wasapi_out".to_owned())
.spawn(move || run_output(run_context, &mut data_callback, &mut error_callback))
.unwrap();
Stream { Stream {
thread: Some(thread), thread: Some(thread),