① Difference between deletion of Data Queue and Mailbox
Both processings are almost same.
② ITRON implementation of deleting Message Buffer
ER del_mbf(ID mbfid)
{
If (called from ISR)
return E_CTX;
Sanity check on arguments;
enter critical section;
for (each task waiting in the send-wait and receive-wait queue) {
Get the task control block from the task ID
Assign E_DLT in the return error code of the task's context;
if task is waiting in Timeout
remove from timer queue
Set task status as Ready
if the task is NOT suspended {
Change the task to the Ready Queue of priority
If (the task priority is higher than the current)
set the flag to call scheduler
} else {
Just delete the task from the send wait queue
}
}
Free all the memory allocated for the data queue;
if (the flag to call scheduler is set) {
call scheduler;
} else {
exit critical section and return E_OK;
}
}
Both processings are almost same.
② ITRON implementation of deleting Message Buffer
ER del_mbf(ID mbfid)
{
If (called from ISR)
return E_CTX;
Sanity check on arguments;
enter critical section;
for (each task waiting in the send-wait and receive-wait queue) {
Get the task control block from the task ID
Assign E_DLT in the return error code of the task's context;
if task is waiting in Timeout
remove from timer queue
Set task status as Ready
if the task is NOT suspended {
Change the task to the Ready Queue of priority
If (the task priority is higher than the current)
set the flag to call scheduler
} else {
Just delete the task from the send wait queue
}
}
Free all the memory allocated for the data queue;
if (the flag to call scheduler is set) {
call scheduler;
} else {
exit critical section and return E_OK;
}
}
No comments:
Post a Comment