forked from Imagelibrary/rtems
Reflect POSIX sched_parm changes.
This commit is contained in:
@@ -49,19 +49,19 @@ int _POSIX_Thread_Translate_sched_param(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( policy == SCHED_SPORADIC ) {
|
if ( policy == SCHED_SPORADIC ) {
|
||||||
if ( (param->ss_replenish_period.tv_sec == 0) &&
|
if ( (param->sched_ss_repl_period.tv_sec == 0) &&
|
||||||
(param->ss_replenish_period.tv_nsec == 0) )
|
(param->sched_ss_repl_period.tv_nsec == 0) )
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
if ( (param->ss_initial_budget.tv_sec == 0) &&
|
if ( (param->sched_ss_init_budget.tv_sec == 0) &&
|
||||||
(param->ss_initial_budget.tv_nsec == 0) )
|
(param->sched_ss_init_budget.tv_nsec == 0) )
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
if ( _Timespec_To_ticks( ¶m->ss_replenish_period ) <
|
if ( _Timespec_To_ticks( ¶m->sched_ss_repl_period ) <
|
||||||
_Timespec_To_ticks( ¶m->ss_initial_budget ) )
|
_Timespec_To_ticks( ¶m->sched_ss_init_budget ) )
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
if ( !_POSIX_Priority_Is_valid( param->ss_low_priority ) )
|
if ( !_POSIX_Priority_Is_valid( param->sched_ss_low_priority ) )
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
*budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_CALLOUT;
|
*budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_CALLOUT;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* COPYRIGHT (c) 1989-2009.
|
* COPYRIGHT (c) 1989-2010.
|
||||||
* On-Line Applications Research Corporation (OAR).
|
* On-Line Applications Research Corporation (OAR).
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* The license and distribution terms for this file may be
|
||||||
@@ -48,9 +48,9 @@ const pthread_attr_t _POSIX_Threads_Default_attributes = {
|
|||||||
SCHED_FIFO, /* schedpolicy */
|
SCHED_FIFO, /* schedpolicy */
|
||||||
{ /* schedparam */
|
{ /* schedparam */
|
||||||
2, /* sched_priority */
|
2, /* sched_priority */
|
||||||
0, /* ss_low_priority */
|
0, /* sched_ss_low_priority */
|
||||||
{ 0L, 0 }, /* ss_replenish_period */
|
{ 0L, 0 }, /* sched_ss_repl_period */
|
||||||
{ 0L, 0 } /* ss_initial_budget */
|
{ 0L, 0 } /* sched_ss_init_budget */
|
||||||
},
|
},
|
||||||
PTHREAD_CREATE_JOINABLE, /* detachstate */
|
PTHREAD_CREATE_JOINABLE, /* detachstate */
|
||||||
1 /* cputime_clock_allowed */
|
1 /* cputime_clock_allowed */
|
||||||
@@ -74,11 +74,11 @@ void _POSIX_Threads_Sporadic_budget_TSR(
|
|||||||
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
|
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
|
||||||
|
|
||||||
/* ticks is guaranteed to be at least one */
|
/* ticks is guaranteed to be at least one */
|
||||||
ticks = _Timespec_To_ticks( &api->schedparam.ss_initial_budget );
|
ticks = _Timespec_To_ticks( &api->schedparam.sched_ss_init_budget );
|
||||||
|
|
||||||
the_thread->cpu_time_budget = ticks;
|
the_thread->cpu_time_budget = ticks;
|
||||||
|
|
||||||
new_priority = _POSIX_Priority_To_core( api->ss_high_priority );
|
new_priority = _POSIX_Priority_To_core( api->schedparam.sched_priority );
|
||||||
the_thread->real_priority = new_priority;
|
the_thread->real_priority = new_priority;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -101,7 +101,7 @@ void _POSIX_Threads_Sporadic_budget_TSR(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ticks is guaranteed to be at least one */
|
/* ticks is guaranteed to be at least one */
|
||||||
ticks = _Timespec_To_ticks( &api->schedparam.ss_replenish_period );
|
ticks = _Timespec_To_ticks( &api->schedparam.sched_ss_repl_period );
|
||||||
|
|
||||||
_Watchdog_Insert_ticks( &api->Sporadic_timer, ticks );
|
_Watchdog_Insert_ticks( &api->Sporadic_timer, ticks );
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ void _POSIX_Threads_Sporadic_budget_callout(
|
|||||||
*/
|
*/
|
||||||
the_thread->cpu_time_budget = 0xFFFFFFFF; /* XXX should be based on MAX_U32 */
|
the_thread->cpu_time_budget = 0xFFFFFFFF; /* XXX should be based on MAX_U32 */
|
||||||
|
|
||||||
new_priority = _POSIX_Priority_To_core( api->schedparam.ss_low_priority );
|
new_priority = _POSIX_Priority_To_core(api->schedparam.sched_ss_low_priority);
|
||||||
the_thread->real_priority = new_priority;
|
the_thread->real_priority = new_priority;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -137,7 +137,7 @@ void _POSIX_Threads_Sporadic_budget_callout(
|
|||||||
if ( the_thread->resource_count == 0 ) {
|
if ( the_thread->resource_count == 0 ) {
|
||||||
/*
|
/*
|
||||||
* Make sure we are actually lowering it. If they have lowered it
|
* Make sure we are actually lowering it. If they have lowered it
|
||||||
* to logically lower than ss_low_priority, then we do not want to
|
* to logically lower than sched_ss_low_priority, then we do not want to
|
||||||
* change it.
|
* change it.
|
||||||
*/
|
*/
|
||||||
if ( the_thread->current_priority < new_priority ) {
|
if ( the_thread->current_priority < new_priority ) {
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ int pthread_create(
|
|||||||
if ( schedpolicy == SCHED_SPORADIC ) {
|
if ( schedpolicy == SCHED_SPORADIC ) {
|
||||||
_Watchdog_Insert_ticks(
|
_Watchdog_Insert_ticks(
|
||||||
&api->Sporadic_timer,
|
&api->Sporadic_timer,
|
||||||
_Timespec_To_ticks( &api->schedparam.ss_replenish_period )
|
_Timespec_To_ticks( &api->schedparam.sched_ss_repl_period )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user