/* * Set task to non-executable state. * Delete the task from the ready queue. * If the deleted task is 'schedtsk', set 'schedtsk' to the * highest priority task in the ready queue. * 'tcb' task must be READY. */ EXPORT void make_non_ready( TCB *tcb ) { ready_queue_delete(&ready_queue, tcb); if ( schedtsk == tcb ) { schedtsk = ready_queue_top(&ready_queue); dispatch_request(); } }
/* * Dispatch enable */ SYSCALL ER _tk_ena_dsp( void ) { CHECK_CTX(!in_loc()); BEGIN_CRITICAL_SECTION dispatch_disabled[get_prid()] = DDS_ENABLE; ready_queue_top(&ready_queue, schedtsk); END_CRITICAL_SECTION return E_OK; }
/* * Reselect task to execute * Set 'schedtsk' to the head task at the ready queue. */ Inline void reschedule( void ) { TCB *toptsk; toptsk = ready_queue_top(&ready_queue); if ( schedtsk != toptsk ) { /* * When the state becomes RUN to READY, * execute the time slice scheduling. */ if ( schedtsk == ctxtsk ) { time_slice_schedule(schedtsk); } schedtsk = toptsk; dispatch_request(); } }