forked from Imagelibrary/rtems
2009-08-01 Joel Sherrill <joel.sherrill@oarcorp.com>
* posix/src/psxtransschedparam.c, posix/src/pthread.c: Add error checks for 0 time on sporadic scheduler replenish period and initial budget. This avoids having to correct for it in the TSR, so we can eliminate the check for ticks == 0 there.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2009-08-01 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* posix/src/psxtransschedparam.c, posix/src/pthread.c: Add error checks
|
||||
for 0 time on sporadic scheduler replenish period and initial budget.
|
||||
This avoids having to correct for it in the TSR, so we can eliminate
|
||||
the check for ticks == 0 there.
|
||||
|
||||
2009-08-01 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* score/inline/rtems/score/heap.inl, score/src/heapresizeblock.c:
|
||||
|
||||
@@ -49,6 +49,14 @@ int _POSIX_Thread_Translate_sched_param(
|
||||
}
|
||||
|
||||
if ( policy == SCHED_SPORADIC ) {
|
||||
if ( (param->ss_replenish_period.tv_sec == 0) &&
|
||||
(param->ss_replenish_period.tv_nsec == 0) )
|
||||
return EINVAL;
|
||||
|
||||
if ( (param->ss_initial_budget.tv_sec == 0) &&
|
||||
(param->ss_initial_budget.tv_nsec == 0) )
|
||||
return EINVAL;
|
||||
|
||||
if ( _Timespec_To_ticks( ¶m->ss_replenish_period ) <
|
||||
_Timespec_To_ticks( ¶m->ss_initial_budget ) )
|
||||
return EINVAL;
|
||||
|
||||
@@ -78,11 +78,9 @@ void _POSIX_Threads_Sporadic_budget_TSR(
|
||||
|
||||
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
|
||||
|
||||
/* ticks is guaranteed to be at least one */
|
||||
ticks = _Timespec_To_ticks( &api->schedparam.ss_initial_budget );
|
||||
|
||||
if ( !ticks )
|
||||
ticks = 1;
|
||||
|
||||
the_thread->cpu_time_budget = ticks;
|
||||
|
||||
new_priority = _POSIX_Priority_To_core( api->ss_high_priority );
|
||||
@@ -92,11 +90,9 @@ void _POSIX_Threads_Sporadic_budget_TSR(
|
||||
the_thread->current_priority > new_priority )
|
||||
_Thread_Change_priority( the_thread, new_priority, true );
|
||||
|
||||
/* ticks is guaranteed to be at least one */
|
||||
ticks = _Timespec_To_ticks( &api->schedparam.ss_replenish_period );
|
||||
|
||||
if ( !ticks )
|
||||
ticks = 1;
|
||||
|
||||
_Watchdog_Insert_ticks( &api->Sporadic_timer, ticks );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user