diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-08-05 13:09:44 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-08-05 13:09:44 +0000 |
commit | 9897065c2198659140ebe0f661be0ce7dda5a95c (patch) | |
tree | 49ef07a15e62da6554dfd5f0546b772cd8ddf14b | |
parent | 2008-08-04 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-9897065c2198659140ebe0f661be0ce7dda5a95c.tar.bz2 |
2008-08-05 Xudong Guan <xudong.guan@criticalsoftware.com>
PR 1212/cpukit
* rtems/src/taskmode.c, score/src/threadtickletimeslice.c: Time slicing
will not happen if the task mode is changed from a non-timeslicing
mode to timeslicing mode if it is done by the executing thread (e.g.
in its task body). This change includes sp44 to demonstrate the
problem and verify the correction.
-rw-r--r-- | cpukit/ChangeLog | 9 | ||||
-rw-r--r-- | cpukit/rtems/src/taskmode.c | 5 | ||||
-rw-r--r-- | cpukit/score/src/threadtickletimeslice.c | 2 |
3 files changed, 13 insertions, 3 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index c51061c338..018ac2da5d 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,12 @@ +2008-08-05 Xudong Guan <xudong.guan@criticalsoftware.com> + + PR 1212/cpukit + * rtems/src/taskmode.c, score/src/threadtickletimeslice.c: Time slicing + will not happen if the task mode is changed from a non-timeslicing + mode to timeslicing mode if it is done by the executing thread (e.g. + in its task body). This change includes sp44 to demonstrate the + problem and verify the correction. + 2008-08-04 Joel Sherrill <joel.sherrill@OARcorp.com> PR 1265/cpukit diff --git a/cpukit/rtems/src/taskmode.c b/cpukit/rtems/src/taskmode.c index 4deccf4918..65fc07a81f 100644 --- a/cpukit/rtems/src/taskmode.c +++ b/cpukit/rtems/src/taskmode.c @@ -89,9 +89,10 @@ rtems_status_code rtems_task_mode( executing->is_preemptible = _Modes_Is_preempt(mode_set) ? TRUE : FALSE; if ( mask & RTEMS_TIMESLICE_MASK ) { - if ( _Modes_Is_timeslice(mode_set) ) + if ( _Modes_Is_timeslice(mode_set) ) { executing->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE; - else + executing->cpu_time_budget = _Thread_Ticks_per_timeslice; + } else executing->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE; } diff --git a/cpukit/score/src/threadtickletimeslice.c b/cpukit/score/src/threadtickletimeslice.c index 0666066b28..5e2d6f8ed5 100644 --- a/cpukit/score/src/threadtickletimeslice.c +++ b/cpukit/score/src/threadtickletimeslice.c @@ -76,7 +76,7 @@ void _Thread_Tickle_timeslice( void ) case THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE: case THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE: - if ( --executing->cpu_time_budget == 0 ) { + if ( (int)(--executing->cpu_time_budget) <= 0 ) { _Thread_Reset_timeslice(); executing->cpu_time_budget = _Thread_Ticks_per_timeslice; } |