sched/: Add debug assertions before each call to up_block_task() to assure that there is no attempt to block an IDLE task.
This commit is contained in:
parent
af96756995
commit
3b22d13493
@ -187,6 +187,11 @@ int nxmq_wait_receive(mqd_t mqdes, FAR struct mqueue_msg_s **rcvmsg)
|
||||
saved_errno = rtcb->pterrno;
|
||||
rtcb->pterrno = OK;
|
||||
|
||||
/* Make sure this is not the idle task, descheduling that
|
||||
* isn't going to end well.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(NULL != rtcb->flink);
|
||||
up_block_task(rtcb, TSTATE_WAIT_MQNOTEMPTY);
|
||||
|
||||
/* When we resume at this point, either (1) the message queue
|
||||
|
@ -291,6 +291,11 @@ int nxmq_wait_send(mqd_t mqdes)
|
||||
saved_errno = rtcb->pterrno;
|
||||
rtcb->pterrno = OK;
|
||||
|
||||
/* Make sure this is not the idle task, descheduling that
|
||||
* isn't going to end well.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(NULL != rtcb->flink);
|
||||
up_block_task(rtcb, TSTATE_WAIT_MQNOTFULL);
|
||||
|
||||
/* When we resume at this point, either (1) the message queue
|
||||
|
@ -142,8 +142,12 @@ void pg_miss(void)
|
||||
* to the next highest priority task.
|
||||
* - The blocked task will be marked with state TSTATE_WAIT_PAGEFILL
|
||||
* and will be retained in the g_waitingforfill prioritized task list.
|
||||
*
|
||||
* Need to firstly check that this is not the idle task,descheduling
|
||||
* that isn't going to end well.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(NULL != ftcb->flink);
|
||||
up_block_task(ftcb, TSTATE_WAIT_PAGEFILL);
|
||||
|
||||
/* Boost the page fill worker thread priority.
|
||||
|
@ -95,8 +95,11 @@ void sched_suspend(FAR struct tcb_s *tcb)
|
||||
/* The task was running or runnable before being stopped. Simply
|
||||
* block it in the stopped state. If tcb refers to this task, then
|
||||
* this action will block this task.
|
||||
* Before doing that make sure this is not the idle task,
|
||||
* descheduling that isn't going to end well.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(NULL != tcb->flink);
|
||||
up_block_task(tcb, TSTATE_TASK_STOPPED);
|
||||
}
|
||||
|
||||
|
@ -163,8 +163,12 @@ int nxsem_wait(FAR sem_t *sem)
|
||||
saved_errno = rtcb->pterrno;
|
||||
rtcb->pterrno = OK;
|
||||
|
||||
/* Add the TCB to the prioritized semaphore wait queue */
|
||||
/* Add the TCB to the prioritized semaphore wait queue, after
|
||||
* checking this is not the idle task - descheduling that
|
||||
* isn't going to end well.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(NULL != rtcb->flink);
|
||||
up_block_task(rtcb, TSTATE_WAIT_SEM);
|
||||
|
||||
/* When we resume at this point, either (1) the semaphore has been
|
||||
|
@ -132,8 +132,12 @@ int sigsuspend(FAR const sigset_t *set)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Its time to wait until one of the unblocked signals is posted */
|
||||
/* Its time to wait until one of the unblocked signals is posted,
|
||||
* but first, ensure this is not the idle task, descheduling that
|
||||
* isn't going to end well.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(NULL != rtcb->flink);
|
||||
up_block_task(rtcb, TSTATE_WAIT_SIG);
|
||||
|
||||
/* We are running again, restore the original sigprocmask */
|
||||
|
@ -357,8 +357,12 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info,
|
||||
(void)wd_start(rtcb->waitdog, waitticks,
|
||||
(wdentry_t)nxsig_timeout, 1, wdparm.pvarg);
|
||||
|
||||
/* Now wait for either the signal or the watchdog */
|
||||
/* Now wait for either the signal or the watchdog, but
|
||||
* first, make sure this is not the idle task,
|
||||
* descheduling that isn't going to end well.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(NULL != rtcb->flink);
|
||||
up_block_task(rtcb, TSTATE_WAIT_SIG);
|
||||
|
||||
/* We no longer need the watchdog */
|
||||
@ -376,8 +380,12 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info,
|
||||
|
||||
else
|
||||
{
|
||||
/* And wait until one of the unblocked signals is posted */
|
||||
/* And wait until one of the unblocked signals is posted,
|
||||
* but first make sure this is not the idle task,
|
||||
* descheduling that isn't going to end well.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(NULL != rtcb->flink);
|
||||
up_block_task(rtcb, TSTATE_WAIT_SIG);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user