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.
This commit is contained in:
Joel Sherrill
2008-08-05 13:11:01 +00:00
parent 014d541f37
commit c25cea9bee
3 changed files with 13 additions and 3 deletions

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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;
}