diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-08-05 13:11:01 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-08-05 13:11:01 +0000 |
commit | c25cea9bee88fb71a6e542ecc8a00398a1532733 (patch) | |
tree | 5002b3023d2ac37c8ce300ed3279d3680c166289 | |
parent | 2008-08-04 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-c25cea9bee88fb71a6e542ecc8a00398a1532733.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 a99fbcd9fe..8e0a72a4e2 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 41f08aa8d0..e58da90c62 100644 --- a/cpukit/score/src/threadtickletimeslice.c +++ b/cpukit/score/src/threadtickletimeslice.c @@ -77,7 +77,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; } |