Add task switching instrumentation for missing case. Contributed by Petri Tanskanen.

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4734 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-05-14 01:03:19 +00:00
parent 0a5b65743c
commit 981846cb54
2 changed files with 20 additions and 12 deletions

View File

@ -2758,3 +2758,5 @@
are multiple queued touchscreen events for the same window and (2) the result of the
first input was to switch windows, then the autoraise implementation will cause the
window to revert to the previous window. Not good behavior.
* sched/sched_mergepending.c: Add task switching instrumentation. There is a case
here where instrumentation was missing. Contributed by Petri Tanskanen.

View File

@ -1,8 +1,8 @@
/************************************************************************
* sched/sched_mergepending.c
*
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Copyright (C) 2007, 2009, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -40,6 +40,7 @@
#include <nuttx/config.h>
#include <stdbool.h>
#include <sched.h>
#include <queue.h>
#include <assert.h>
@ -135,24 +136,29 @@ bool sched_mergepending(void)
rtrprev = rtrtcb->blink;
if (!rtrprev)
{
/* Special case: Inserting pndtcb at the head of the list */
/* Special case: Inserting pndtcb at the head of the list */
/* Inform the instrumentation layer that we are switching tasks */
pndtcb->flink = rtrtcb;
pndtcb->blink = NULL;
rtrtcb->blink = pndtcb;
g_readytorun.head = (FAR dq_entry_t*)pndtcb;
sched_note_switch(rtrtcb, pndtcb);
/* Then insert at the head of the list */
pndtcb->flink = rtrtcb;
pndtcb->blink = NULL;
rtrtcb->blink = pndtcb;
g_readytorun.head = (FAR dq_entry_t*)pndtcb;
rtrtcb->task_state = TSTATE_TASK_READYTORUN;
pndtcb->task_state = TSTATE_TASK_RUNNING;
ret = true;
ret = true;
}
else
{
/* Insert in the middle of the list */
pndtcb->flink = rtrtcb;
pndtcb->blink = rtrprev;
rtrprev->flink = pndtcb;
rtrtcb->blink = pndtcb;
pndtcb->flink = rtrtcb;
pndtcb->blink = rtrprev;
rtrprev->flink = pndtcb;
rtrtcb->blink = pndtcb;
pndtcb->task_state = TSTATE_TASK_READYTORUN;
}
}