Hi All:

I am a new to RTOS and  have been studying the source code of atomthreads for a 
while,  and now I have question about the atomThreadSwitch function in 
atomkernel.c. 

The source code without comments of atomThreadSwitch is :
static void atomThreadSwitch(ATOM_TCB *old_tcb, ATOM_TCB *new_tcb)
    {
           if (old_tcb != new_tcb)
        {
            /* Set the new currently-running thread pointer */
            curr_tcb = new_tcb;

        /* Call the architecture-specific context switch */
            archContextSwitch (old_tcb, new_tcb);
        }

     old_tcb->suspended = FALSE;

   }

My question is about the last line :   "old_tcb->suspended = FALSE". Only when 
the old thread been scheduled back in, the RTOS can run to here. This means 
that when the RTOS runs to here , the old thread has been scheduled out, so the 
state of the old thread can not be suspended, And why have to set the state of 
suspended false here?


With Regards,
Elvin

Reply via email to