diff --git a/src/main.rs b/src/main.rs index 53fdf955..392442de 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,7 @@ use crossterm::{ }, ExecutableCommand, Result, }; +use log::error; use scopetime::scope_time; use simplelog::*; use std::{env, fs, fs::File, io}; @@ -34,13 +35,16 @@ fn main() -> Result<()> { let mut app = App::new(tx_git); - let rx_input = poll::start_polling_thread(); - rayon_core::ThreadPoolBuilder::new() - .panic_handler(|e| panic!(e)) + .panic_handler(|e| { + error!("thread panic: {:?}", e); + panic!(e) + }) .build_global() .unwrap(); + let rx_input = poll::start_polling_thread(); + app.update(); loop { diff --git a/src/poll.rs b/src/poll.rs index d6ab2b7a..8b994755 100644 --- a/src/poll.rs +++ b/src/poll.rs @@ -2,7 +2,7 @@ use asyncgit::AsyncNotification; use crossbeam_channel::{unbounded, Receiver}; use crossterm::event::{self, Event}; use std::{ - thread::{self, sleep}, + thread::sleep, time::{Duration, Instant}, }; @@ -27,7 +27,7 @@ pub fn start_polling_thread() -> Receiver> { let (tx, rx) = unbounded(); let tx1 = tx.clone(); - thread::spawn(move || { + rayon_core::spawn(move || { let mut last_send = Instant::now(); let mut batch = Vec::new(); @@ -51,7 +51,7 @@ pub fn start_polling_thread() -> Receiver> { } }); - thread::spawn(move || loop { + rayon_core::spawn(move || loop { tx.send(vec![QueueEvent::Tick]).unwrap(); sleep(TICK_DURATION); });