diff options
Diffstat (limited to '')
-rw-r--r-- | cpukit/posix/include/rtems/posix/pthreadimpl.h | 4 | ||||
-rw-r--r-- | cpukit/posix/src/pthread.c | 5 | ||||
-rw-r--r-- | cpukit/posix/src/pthreadcreate.c | 12 |
3 files changed, 11 insertions, 10 deletions
diff --git a/cpukit/posix/include/rtems/posix/pthreadimpl.h b/cpukit/posix/include/rtems/posix/pthreadimpl.h index 990a842168..ba99392574 100644 --- a/cpukit/posix/include/rtems/posix/pthreadimpl.h +++ b/cpukit/posix/include/rtems/posix/pthreadimpl.h @@ -54,9 +54,13 @@ extern Thread_Information _POSIX_Threads_Information; extern pthread_attr_t _POSIX_Threads_Default_attributes; RTEMS_INLINE_ROUTINE void _POSIX_Threads_Sporadic_timer_insert( + Thread_Control *the_thread, POSIX_API_Control *api ) { + the_thread->cpu_time_budget = + _Timespec_To_ticks( &api->Attributes.schedparam.sched_ss_init_budget ); + _Watchdog_Per_CPU_insert_relative( &api->Sporadic_timer, _Per_CPU_Get(), diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c index 622052c250..432f70cf1b 100644 --- a/cpukit/posix/src/pthread.c +++ b/cpukit/posix/src/pthread.c @@ -113,11 +113,8 @@ void _POSIX_Threads_Sporadic_budget_TSR( Watchdog_Control *watchdog ) _Thread_State_acquire( the_thread, &lock_context ); - the_thread->cpu_time_budget = - _Timespec_To_ticks( &api->schedparam.sched_ss_init_budget ); - _Watchdog_Per_CPU_remove_relative( &api->Sporadic_timer ); - _POSIX_Threads_Sporadic_timer_insert( api ); + _POSIX_Threads_Sporadic_timer_insert( the_thread, api ); new_priority = _POSIX_Priority_To_core( api->schedparam.sched_priority ); diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c index af19313689..a120fdda8d 100644 --- a/cpukit/posix/src/pthreadcreate.c +++ b/cpukit/posix/src/pthreadcreate.c @@ -229,6 +229,12 @@ int pthread_create( api->schedpolicy = schedpolicy; api->schedparam = schedparam; + if ( schedpolicy == SCHED_SPORADIC ) { + _ISR_lock_ISR_disable( &lock_context ); + _POSIX_Threads_Sporadic_timer_insert( the_thread, api ); + _ISR_lock_ISR_enable( &lock_context ); + } + /* * POSIX threads are allocated and started in one operation. */ @@ -249,12 +255,6 @@ int pthread_create( } #endif - if ( schedpolicy == SCHED_SPORADIC ) { - _ISR_lock_ISR_disable( &lock_context ); - _POSIX_Threads_Sporadic_timer_insert( api ); - _ISR_lock_ISR_enable( &lock_context ); - } - /* * Return the id and indicate we successfully created the thread */ |