fn take_command(command: &Arc<Mutex<Option<ThreadCommands>>>) -> Option<ThreadCommands> {
    let mut command = command.lock().unwrap();
    // Take the command, ensuring whatever it is now set to None, avoid duplicate messages
    return command.take();
}
// Use this when you want to clear the command as well as read it
Use this when you want to clear the command as well as read it
Use this when you want to clear the command as well as read it
fn take_command(command: &Arc<Mutex<Option<ThreadCommands>>>) -> Option<ThreadCommands> {
    let mut command = command.lock().unwrap();
    // Take the command, ensuring whatever it is now set to None, avoid duplicate messages
    return command.take();
}
fn take_command ( command : & Arc < Mutex < Option < ThreadCommands > > > ) -> Option < ThreadCommands > { let mut command = command . lock ( ) . unwrap ( ) ; // Take the command, ensuring whatever it is now set to None, avoid duplicate messages return command . take ( ) ; }
Use this when you want to clear the command as well as read it
Use this when you want to clear the command as well as read it
command
&Arc<Mutex<Option<ThreadCommands>>>
command
&Arc<Mutex<Option<ThreadCommands>>>