Skip to content

Commit

Permalink
Add the thread handle back as an ignored field
Browse files Browse the repository at this point in the history
  • Loading branch information
joshka committed Sep 4, 2024
1 parent b012841 commit a808d3b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions simple-generated/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ pub enum Event {
pub struct EventSource {
/// Event receiver channel.
receiver: mpsc::Receiver<Event>,
/// Handle to the event thread.
_handle: thread::JoinHandle<()>,
}

impl EventSource {
/// Constructs a new instance of [`EventHandler`].
pub fn new(tick_rate: Duration) -> Self {
let (sender, receiver) = mpsc::channel();
thread::spawn(move || event_thread(sender, tick_rate));
Self { receiver }
let _handle = thread::spawn(move || event_thread(sender, tick_rate));
Self { receiver, _handle }
}

/// Receive the next event from the handler thread.
Expand Down
6 changes: 4 additions & 2 deletions simple/template/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ pub enum Event {
pub struct EventSource {
/// Event receiver channel.
receiver: mpsc::Receiver<Event>,
/// Handle to the event thread.
_handle: thread::JoinHandle<()>,
}

impl EventSource {
/// Constructs a new instance of [`EventHandler`].
pub fn new(tick_rate: Duration) -> Self {
let (sender, receiver) = mpsc::channel();
thread::spawn(move || event_thread(sender, tick_rate));
Self { receiver }
let _handle = thread::spawn(move || event_thread(sender, tick_rate));
Self { receiver, _handle }
}

/// Receive the next event from the handler thread.
Expand Down

0 comments on commit a808d3b

Please sign in to comment.