pub(crate) fn stop(&self, tid: Tid, context: Box<Context>) {
        let mut proc_lock = self.threads[tid].lock();
        let proc = proc_lock.as_mut().expect("thread not exist");
        proc.status = proc.status_after_stop.clone();
        proc.status_after_stop = Status::Ready;
        proc.context = Some(context);
        match proc.status {
            Status::Ready => self.scheduler.push(tid),
            Status::Exited(_) => self.exit_handler(proc),
            _ => {}
        }
    }
/// Called by Processor to finish running a thread
/// and give its context back.
Called by Processor to finish running a thread
and give its context back.
Called by Processor to finish running a thread and give its context back .
pub(crate) fn stop(&self, tid: Tid, context: Box<Context>) {
        let mut proc_lock = self.threads[tid].lock();
        let proc = proc_lock.as_mut().expect("thread not exist");
        proc.status = proc.status_after_stop.clone();
        proc.status_after_stop = Status::Ready;
        proc.context = Some(context);
        match proc.status {
            Status::Ready => self.scheduler.push(tid),
            Status::Exited(_) => self.exit_handler(proc),
            _ => {}
        }
    }
pub ( crate ) fn stop ( & self , tid : Tid , context : Box < Context > ) { let mut proc_lock = self . threads [ tid ] . lock ( ) ; let proc = proc_lock . as_mut ( ) . expect ( " " ) ; proc . status = proc . status_after_stop . clone ( ) ; proc . status_after_stop = Status :: Ready ; proc . context = Some ( context ) ; match proc . status { Status :: Ready => self . scheduler . push ( tid ) , Status :: Exited ( _ ) => self . exit_handler ( proc ) , _ => { } } }
Called by Processor to finish running a thread
and give its context back.
Called by Processor to finish running a thread and give its context back .
&self
tid
Tid
context
Box<Context>
&self
tid
Tid
context
Box<Context>