SMP: Fix backward spinlock test

This commit is contained in:
Gregory Nutt 2016-02-15 11:06:54 -06:00
parent 8399938138
commit 8ea1bc3188
2 changed files with 6 additions and 7 deletions

View File

@ -227,7 +227,7 @@ void spin_unlockr(FAR struct spinlock_s *lock);
* Name: spin_islocked
*
* Description:
* Release one count on a renonentrant spinlock.
* Release one count on a non-reentrant spinlock.
*
* Input Parameters:
* lock - A reference to the spinlock object to test.
@ -238,7 +238,7 @@ void spin_unlockr(FAR struct spinlock_s *lock);
****************************************************************************/
/* bool spin_islocked(FAR spinlock_t lock); */
#define spin_islocked(l) ((l) == SP_UNLOCKED)
#define spin_islocked(l) ((l) == SP_LOCKED)
/****************************************************************************
* Name: spin_islockedr
@ -255,7 +255,7 @@ void spin_unlockr(FAR struct spinlock_s *lock);
****************************************************************************/
/* bool spin_islockedr(FAR struct spinlock_s *lock); */
#define spin_islockedr(l) ((l)->sp_lock == SP_UNLOCKED)
#define spin_islockedr(l) ((l)->sp_lock == SP_LOCKED)
#endif /* CONFIG_SPINLOCK */
#endif /* __INCLUDE_NUTTX_SPINLOCK_H */

View File

@ -74,7 +74,6 @@
bool sched_removereadytorun(FAR struct tcb_s *rtcb)
{
FAR struct tcb_s *ntcb = NULL;
FAR dq_queue_t *tasklist;
bool ret = false;
@ -94,19 +93,19 @@ bool sched_removereadytorun(FAR struct tcb_s *rtcb)
* occur.
*/
if (!rtcb->blink || TLIST_ISRUNNABLE(rtcb->task_state))
if (rtcb->blink == NULL && TLIST_ISRUNNABLE(rtcb->task_state))
#else
/* There is only one list, g_readytorun, and it always contains the
* currently running task. If we are removing the head of this list,
* then we are removing the currently active task.
*/
if (!rtcb->blink)
if (rtcb->blink == NULL)
#endif
{
/* There must always be at least one task in the list (the idle task) */
ntcb = (FAR struct tcb_s *)rtcb->flink;
FAR struct tcb_s *ntcb = (FAR struct tcb_s *)rtcb->flink;
DEBUGASSERT(ntcb != NULL);
#ifdef CONFIG_SMP