//block until our worker thread is stopped
block until our worker thread is stopped
block until our worker thread is stopped
pub fn stop(&mut self) {
        if self.thread_handle.is_none() {
            panic!("Our thread handler is missing! We should have one at this point");
        }
        // Remove pending elements from the queue
        let mut queue = self.queue.lock().unwrap();
        queue.clear();
        drop(queue);
        // Tell our thread to finish peacefully
        set_command(ThreadCommands::FINISH, &self.thread_command.clone());
        // Here we have to take the handle to avoid a copy of JoinHandle, as it doesn't exist
        let handle = self.thread_handle.take().unwrap();
        handle.join().expect("Problem waiting on our thread!");
    }
pub fn stop ( & mut self ) { if self . thread_handle . is_none ( ) { panic ! ( " " ) ; } // Remove pending elements from the queue let mut queue = self . queue . lock ( ) . unwrap ( ) ; queue . clear ( ) ; drop ( queue ) ; // Tell our thread to finish peacefully set_command ( ThreadCommands :: FINISH , & self . thread_command . clone ( ) ) ; // Here we have to take the handle to avoid a copy of JoinHandle, as it doesn't exist let handle = self . thread_handle . take ( ) . unwrap ( ) ; handle . join ( ) . expect ( " " ) ; }
block until our worker thread is stopped
block until our worker thread is stopped
&mut self