diff --git a/ChangeLog b/ChangeLog index f3bed6a848..1311332177 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/sched/sched_mergepending.c b/sched/sched_mergepending.c index 1448c00961..202228412c 100644 --- a/sched/sched_mergepending.c +++ b/sched/sched_mergepending.c @@ -1,8 +1,8 @@ /************************************************************************ * sched/sched_mergepending.c * - * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2007, 2009, 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -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; } }