pub(crate) fn run(&self, cpu_id: usize) -> Option<(Tid, Box<Context>)> {
        self.scheduler.pop(cpu_id)
            .map(|tid| {
                let mut proc_lock = self.threads[tid].lock();
                let mut proc = proc_lock.as_mut().expect("thread not exist");
                proc.status = Status::Running(cpu_id);
                (tid, proc.context.take().expect("context not exist"))
            })
    }
/// Called by Processor to get a thread to run.
/// The manager first mark it `Running`,
/// then take out and return its Context.
Called by Processor to get a thread to run.
The manager first mark it `Running`,
then take out and return its Context.
Called by Processor to get a thread to run . The manager first mark it ` Running ` then take out and return its Context .
pub(crate) fn run(&self, cpu_id: usize) -> Option<(Tid, Box<Context>)> {
        self.scheduler.pop(cpu_id)
            .map(|tid| {
                let mut proc_lock = self.threads[tid].lock();
                let mut proc = proc_lock.as_mut().expect("thread not exist");
                proc.status = Status::Running(cpu_id);
                (tid, proc.context.take().expect("context not exist"))
            })
    }
pub ( crate ) fn run ( & self , cpu_id : usize ) -> Option < ( Tid , Box < Context > ) > { self . scheduler . pop ( cpu_id ) . map ( | tid | { let mut proc_lock = self . threads [ tid ] . lock ( ) ; let mut proc = proc_lock . as_mut ( ) . expect ( " " ) ; proc . status = Status :: Running ( cpu_id ) ; ( tid , proc . context . take ( ) . expect ( " " ) ) } ) }
Called by Processor to get a thread to run.
Called by Processor to get a thread to run .
&self
cpu_id
usize
&self
cpu_id
usize