Ejemplo n.º 1
0
/* |------------------+-------------------------------------------------------------| */
StatusType Schedule ( void )
{
    StatusType ercd = E_OK;
	OS_CHECK_EXT(!in_indp(),E_OS_CALLEVEL);
	OS_CHECK_EXT(isQueEmpty(&knl_ctxtsk->resque),E_OS_RESOURCE);

	BEGIN_CRITICAL_SECTION;
	//if task has internal resource or task is non-premtable
	if(knl_ready_queue.top_priority <= knl_ctxtsk->itskpri)
	{	//release internal resource or for Non-Preemtable Task
    	knl_ctxtsk->priority = knl_ctxtsk->itskpri;  
        knl_reschedule();
    }
	END_CRITICAL_SECTION;

	//re-get internal resource or for Non-Preemtable task
	knl_ctxtsk->priority = knl_ctxtsk->runpri;

	Error_Exit:
	#if(cfgOS_ERROR_HOOK == STD_ON)
	if(E_OK != ercd)
	{
    	BEGIN_CRITICAL_SECTION;
    	_errorhook_svcid = OSServiceId_Schedule;
    	CallErrorHook(ercd);
    	END_CRITICAL_SECTION;
	}
	#endif /* cfgOS_ERROR_HOOK */
    return ercd;
}
Ejemplo n.º 2
0
/* |------------------+-------------------------------------------------------------| */
StatusType Schedule ( void )
{
    StatusType ercd = E_NOT_OK;
	OS_CHECK_EXT(!in_indp(),E_OS_CALLEVEL);
	OS_CHECK_EXT(isQueEmpty(&knl_ctxtsk->resque),E_OS_RESOURCE);
	//As Internal Resource was not supported,So in fact this API only has effect on
	//Non-preemtable Task.
	BEGIN_CRITICAL_SECTION;
    knl_reschedule();
	END_CRITICAL_SECTION;
	Error_Exit:
    return ercd;
}