wup_tsk requests are queued up. So, it can be issued for self too. But, rel_wai is issued against a waiting one to just exit from waiting. So, it cannot be issued for self. Some of the differences listed in uITRON specification are as follows:
- rel_wai releases a task from any waiting state, while wup_tsk only releases a task from the sleeping state
- To the task in the sleeping state, a success (E_OK) is returned when the task is released from sleeping with slp_tsk, while an error (E_RLWAI) is returned when the task is forcibly released from waiting with rel_wai.
- wup_tsk will increment the wakeup request count if the task is not in the sleeping state. On the other hand, rel_wai will return E_OBJ error if the task is not waiting.
ER rel_wai(ID tskid)
{
if (tskid is TSK_SELF)
return E_OBJ;
if (Task ID is greater than maximum of Task ID)
return E_ID;
Enter critical section
Take TCB
if (TCB == NULL)
return E_NOEXS;
Take status from TCB
if (waiting with timeout) {
clear the waiting with timeout flag;
remove from timer queue;
}
if (waiting for any resource) {
make status as Ready
set error code as E_RLWAI;
if (resource is mutex) {
get the mutex waiting for
delete from the wait queue
if (inheritence protocol) && tcb priority is equal or
higher than ceiling)
rearrange_priority_for_mutex(taskid locking mutex);
if (suspend count is zero) { /* ??? */
/* Why without any condition, anonymously dispatch is performed */
add to Ready queue and dispatch;
return;
} else { /* suspended */
exit critical section;
return;
}
} else if (resource is message buffer or variable memory pool){
remove from waiting queue;
if (suspend count is zero)
/* change to Ready queue; */ /* ??? */
should be add to Ready queue as removed above.
There is chance for new task to get chance, try it.
If (there is alteration in try or this task
priority is higher than application priority) {
dispatch();
return;
} else {
exit critical section;
return;
}
} /* Waiting for any other resources */
else if (suspension count is zero) {
change to ready queue;
dispatch;
return;
} else { /* Under suspension */
just remove from waiting queue;
exit critical section;
return;
}
}
/* Finally sleep or dly task */
if (status is sleeping or delay task or rendezvous completion wait) {
make tcb status as Ready;
set error code as E_RLWAI;
/* already removed from Timer queue if waiting in */
if (suspension count is zero) {
add to ready queue;
dispatch;
return;
} else { /* Under suspension */
just remove from waiting queue;
exit critical section;
return;
}
}
Exit critical section;
Return E_OBJ;
}
Hey, no need to do it! Return back immediately !!
1 comment:
Online Casino Sites in Jamaica | ChoGenoCasino.com
and other 제왕카지노 casinos at ChoGeno Casino, along with their slots and choegocasino table games, 1xbet korean online, poker, casino games and casino tables.
Post a Comment