generated from GarandPLG/rust-flake-template
Drop JoinHandle variables and thread joins
Thread handles are no longer kept; spawn threads directly and omit the join calls. The unused `JoinHandle` import and related comments are removed.
This commit is contained in:
+3
-9
@@ -3,7 +3,7 @@ use std::{
|
||||
io::{Result, Stdout},
|
||||
mem::replace,
|
||||
sync::mpsc::{Receiver, Sender, channel},
|
||||
thread::{self, JoinHandle},
|
||||
thread,
|
||||
};
|
||||
use war_in_tunnels::{
|
||||
app::{
|
||||
@@ -27,14 +27,12 @@ fn main() -> Result<()> {
|
||||
|
||||
let input_tx: Sender<KeyEvent> = channels.input_tx.clone();
|
||||
let resize_tx: Sender<(u16, u16)> = channels.resize_tx.clone();
|
||||
let events_thread: JoinHandle<()> =
|
||||
thread::spawn(move || handle_ct_events(input_tx, resize_tx));
|
||||
thread::spawn(move || handle_ct_events(input_tx, resize_tx));
|
||||
|
||||
let tick_tx: Sender<()> = channels.tick_tx.clone();
|
||||
let tick_thread: JoinHandle<()> = thread::spawn(move || handle_tick_event(tick_tx, TICK_MS));
|
||||
thread::spawn(move || handle_tick_event(tick_tx, TICK_MS));
|
||||
|
||||
let audio_rx: Receiver<AudioCmd> = replace(&mut channels.audio_rx, channel().1);
|
||||
// let audio_thread: JoinHandle<()> =
|
||||
thread::spawn(move || {
|
||||
handle_audio(audio_rx, args.mute, args.sound_track);
|
||||
});
|
||||
@@ -46,9 +44,5 @@ fn main() -> Result<()> {
|
||||
|
||||
ratatui::restore();
|
||||
|
||||
let _ = events_thread.join();
|
||||
let _ = tick_thread.join();
|
||||
// let _ = audio_thread.join(); // TODO: kill playing music
|
||||
|
||||
app_result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user