fn run_task(&mut self, time_slice: Duration, stats: &mut ExecutorStats) -> bool {
        if let Some(task) = find_task(&self.work, &self.run_queue, &self.stealers) {
            RUN_QUEUE_LEN.fetch_sub(1, Ordering::SeqCst);
            // stats.time_on_queue += task.elapsed();
            // log::trace!("exec {} task for machine {}", self.id, task.machine.get_key());

            // setup TLS in case we have to park
            let machine = task;
            let task_id = machine.get_task_id();
            let default_machine = tls_executor_data.with(|t| {
                let mut tls = t.borrow_mut();
                let default_machine = tls.machine.to_owned();
                tls.machine = Arc::clone(&machine);
                tls.task_id = task_id;
                default_machine
            });

            // log::trace!("exec {} run_q {}, begin recv machine {}", self.id, task.id, machine.get_key());
            let t = Instant::now();
            machine.receive_cmd(&machine, time_slice, stats);
            stats.recv_time += t.elapsed();
            if machine.get_state() == MachineState::SendBlock {
                stats.blocked_senders += 1;
            }
            // log::trace!("exec {} run_q {}, end recv machine {}", self.id, task.id, machine.get_key());

            // reset TLS now that we're done with the task
            tls_executor_data.with(|t| {
                let mut tls = t.borrow_mut();
                tls.machine = default_machine;
                tls.task_id = 0;
                self.blocked_sender_count = tls.blocked_senders.len();
            });

            machine.clear_task_id();
            self.reschedule(machine);
            if self.shared_info.get_state() == ExecutorState::Parked {
                log::debug!("parked executor {} completed", self.id);
            }

            // since we did a bunch of work we can leave
            true
        } else {
            false
        }
    }
// if we're still running, run get a task and run it. If no tasks, yeild
if we're still running, run get a task and run it. If no tasks, yeild
if we ' re still running run get a task and run it . If no tasks yeild
fn run_task(&mut self, time_slice: Duration, stats: &mut ExecutorStats) -> bool {
        if let Some(task) = find_task(&self.work, &self.run_queue, &self.stealers) {
            RUN_QUEUE_LEN.fetch_sub(1, Ordering::SeqCst);
            // stats.time_on_queue += task.elapsed();
            // log::trace!("exec {} task for machine {}", self.id, task.machine.get_key());
            // setup TLS in case we have to park
            let machine = task;
            let task_id = machine.get_task_id();
            let default_machine = tls_executor_data.with(|t| {
                let mut tls = t.borrow_mut();
                let default_machine = tls.machine.to_owned();
                tls.machine = Arc::clone(&machine);
                tls.task_id = task_id;
                default_machine
            });
            // log::trace!("exec {} run_q {}, begin recv machine {}", self.id, task.id, machine.get_key());
            let t = Instant::now();
            machine.receive_cmd(&machine, time_slice, stats);
            stats.recv_time += t.elapsed();
            if machine.get_state() == MachineState::SendBlock {
                stats.blocked_senders += 1;
            }
            // log::trace!("exec {} run_q {}, end recv machine {}", self.id, task.id, machine.get_key());
            // reset TLS now that we're done with the task
            tls_executor_data.with(|t| {
                let mut tls = t.borrow_mut();
                tls.machine = default_machine;
                tls.task_id = 0;
                self.blocked_sender_count = tls.blocked_senders.len();
            });
            machine.clear_task_id();
            self.reschedule(machine);
            if self.shared_info.get_state() == ExecutorState::Parked {
                log::debug!("parked executor {} completed", self.id);
            }
            // since we did a bunch of work we can leave
            true
        } else {
            false
        }
    }
fn run_task ( & mut self , time_slice : Duration , stats : & mut ExecutorStats ) -> bool { if let Some ( task ) = find_task ( & self . work , & self . run_queue , & self . stealers ) { RUN_QUEUE_LEN . fetch_sub ( 1 , Ordering :: SeqCst ) ; // stats.time_on_queue += task.elapsed(); // log::trace!("exec {} task for machine {}", self.id, task.machine.get_key()); // setup TLS in case we have to park let machine = task ; let task_id = machine . get_task_id ( ) ; let default_machine = tls_executor_data . with ( | t | { let mut tls = t . borrow_mut ( ) ; let default_machine = tls . machine . to_owned ( ) ; tls . machine = Arc :: clone ( & machine ) ; tls . task_id = task_id ; default_machine } ) ; // log::trace!("exec {} run_q {}, begin recv machine {}", self.id, task.id, machine.get_key()); let t = Instant :: now ( ) ; machine . receive_cmd ( & machine , time_slice , stats ) ; stats . recv_time += t . elapsed ( ) ; if machine . get_state ( ) == MachineState :: SendBlock { stats . blocked_senders += 1 ; } // log::trace!("exec {} run_q {}, end recv machine {}", self.id, task.id, machine.get_key()); // reset TLS now that we're done with the task tls_executor_data . with ( | t | { let mut tls = t . borrow_mut ( ) ; tls . machine = default_machine ; tls . task_id = 0 ; self . blocked_sender_count = tls . blocked_senders . len ( ) ; } ) ; machine . clear_task_id ( ) ; self . reschedule ( machine ) ; if self . shared_info . get_state ( ) == ExecutorState :: Parked { log :: debug ! ( " " self id ) ; } // since we did a bunch of work we can leave true } else { false } }
if we're still running, run get a task and run it.
if we ' re still running run get a task and run it .
&mut self
time_slice
Duration
stats
&mut ExecutorStats