diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-17 21:32:21 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-17 21:32:21 +0000 |
commit | e9faebc794c798462a34d5fae9c922d46e95a374 (patch) | |
tree | 41f650510bb4f327ed7bf981fac39bef006d8bb7 /nuttx/sched/sched_processtimer.c | |
parent | 054179a134bf123279f6c3774a773d838e95c181 (diff) | |
download | px4-nuttx-e9faebc794c798462a34d5fae9c922d46e95a374.tar.gz px4-nuttx-e9faebc794c798462a34d5fae9c922d46e95a374.tar.bz2 px4-nuttx-e9faebc794c798462a34d5fae9c922d46e95a374.zip |
Add test of roundrobin scheduler (still does not work)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@81 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/sched_processtimer.c')
-rw-r--r-- | nuttx/sched/sched_processtimer.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/nuttx/sched/sched_processtimer.c b/nuttx/sched/sched_processtimer.c index c6ee8fdb8..3decd12e7 100644 --- a/nuttx/sched/sched_processtimer.c +++ b/nuttx/sched/sched_processtimer.c @@ -91,31 +91,41 @@ static void sched_process_timeslice(void) if (rtcb->timeslice <= 1) { - /* We know we are at the head of the ready to run - * prioritized list. We must be the highest priority - * task eligible for execution. Check the next task - * in the ready to run list. If it is the same - * priority, then we need to relinquish the CPU and - * give that task a shot. + + /* Yes, Now check if the task has pre-emption disabled. + * If so, then we will freeze the timeslice count at + * the value until the next tick after pre-emption + * has been enabled. */ - if (rtcb->flink && - rtcb->flink->sched_priority >= rtcb->sched_priority) + if (!rtcb->lockcount) { - struct sched_param param; - - /* Reset the timeslice */ + /* Reset the timeslice in any case. */ rtcb->timeslice = CONFIG_RR_INTERVAL; - /* Just resetting the task priority to its current - * value. This this will cause the task to be - * rescheduled behind any other tasks at the same - * priority. + /* We know we are at the head of the ready to run + * prioritized list. We must be the highest priority + * task eligible for execution. Check the next task + * in the ready to run list. If it is the same + * priority, then we need to relinquish the CPU and + * give that task a shot. */ - param.sched_priority = rtcb->sched_priority; - (void)sched_setparam(0, ¶m); + if (rtcb->flink && + rtcb->flink->sched_priority >= rtcb->sched_priority) + { + struct sched_param param; + + /* Just resetting the task priority to its current + * value. This this will cause the task to be + * rescheduled behind any other tasks at the same + * priority. + */ + + param.sched_priority = rtcb->sched_priority; + (void)sched_setparam(0, ¶m); + } } } else |