aboutsummaryrefslogtreecommitdiff
path: root/nuttx/sched
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-05-14 01:03:19 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-05-14 01:03:19 +0000
commit0aaa3c8bafa025a1596c03691b516f23c6d8a081 (patch)
tree069a9a4cfbe5124946533f9a526dcfb227107b06 /nuttx/sched
parent47125132adb0ef34b429f2563b860c713a037032 (diff)
downloadpx4-firmware-0aaa3c8bafa025a1596c03691b516f23c6d8a081.tar.gz
px4-firmware-0aaa3c8bafa025a1596c03691b516f23c6d8a081.tar.bz2
px4-firmware-0aaa3c8bafa025a1596c03691b516f23c6d8a081.zip
Add task switching instrumentation for missing case. Contributed by Petri Tanskanen.
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4734 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/sched')
-rw-r--r--nuttx/sched/sched_mergepending.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/nuttx/sched/sched_mergepending.c b/nuttx/sched/sched_mergepending.c
index 1448c0096..202228412 100644
--- a/nuttx/sched/sched_mergepending.c
+++ b/nuttx/sched/sched_mergepending.c
@@ -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;
}
}