summaryrefslogtreecommitdiffstats
path: root/cpukit/posix
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-12-01 20:42:48 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-12-02 12:41:03 +0100
commit5b6c290ed0fae8f9afd343c891e6d3650ef22492 (patch)
treef01c2825980599091959ff403c98fb95ee5851d3 /cpukit/posix
parentposix: Fix typo (diff)
downloadrtems-5b6c290ed0fae8f9afd343c891e6d3650ef22492.tar.bz2
score: Initialize thread queue context early
Initialize thread queue context early preferably outside the critical section. Remove implicit _Thread_queue_Context_initialize() from _Thread_Wait_acquire().
Diffstat (limited to 'cpukit/posix')
-rw-r--r--cpukit/posix/src/mutexsetprioceiling.c2
-rw-r--r--cpukit/posix/src/pthread.c6
-rw-r--r--cpukit/posix/src/pthreadgetschedparam.c2
-rw-r--r--cpukit/posix/src/pthreadsetschedparam.c3
-rw-r--r--cpukit/posix/src/pthreadsetschedprio.c3
5 files changed, 11 insertions, 5 deletions
diff --git a/cpukit/posix/src/mutexsetprioceiling.c b/cpukit/posix/src/mutexsetprioceiling.c
index f483a2b495..9288ffd828 100644
--- a/cpukit/posix/src/mutexsetprioceiling.c
+++ b/cpukit/posix/src/mutexsetprioceiling.c
@@ -67,6 +67,8 @@ int pthread_mutex_setprioceiling(
Thread_queue_Context queue_context;
Per_CPU_Control *cpu_self;
+ _Thread_queue_Context_initialize( &queue_context );
+ _Thread_queue_Context_clear_priority_updates( &queue_context );
_CORE_ceiling_mutex_Set_priority(
&the_mutex->Mutex,
new_priority,
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index eb7d652d77..e096dd6bea 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -91,8 +91,9 @@ void _POSIX_Threads_Sporadic_timer( Watchdog_Control *watchdog )
api = RTEMS_CONTAINER_OF( watchdog, POSIX_API_Control, Sporadic.Timer );
the_thread = api->thread;
- _Thread_Wait_acquire( the_thread, &queue_context );
+ _Thread_queue_Context_initialize( &queue_context );
_Thread_queue_Context_clear_priority_updates( &queue_context );
+ _Thread_Wait_acquire( the_thread, &queue_context );
if ( _Priority_Node_is_active( &api->Sporadic.Low_priority ) ) {
_Thread_Priority_add(
@@ -122,8 +123,9 @@ void _POSIX_Threads_Sporadic_budget_callout( Thread_Control *the_thread )
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
- _Thread_Wait_acquire( the_thread, &queue_context );
+ _Thread_queue_Context_initialize( &queue_context );
_Thread_queue_Context_clear_priority_updates( &queue_context );
+ _Thread_Wait_acquire( the_thread, &queue_context );
/*
* This will prevent the thread from consuming its entire "budget"
diff --git a/cpukit/posix/src/pthreadgetschedparam.c b/cpukit/posix/src/pthreadgetschedparam.c
index b60022d87f..b809db95dc 100644
--- a/cpukit/posix/src/pthreadgetschedparam.c
+++ b/cpukit/posix/src/pthreadgetschedparam.c
@@ -45,6 +45,7 @@ int pthread_getschedparam(
return EINVAL;
}
+ _Thread_queue_Context_initialize( &queue_context );
the_thread = _Thread_Get( thread, &queue_context.Lock_context.Lock_context );
if ( the_thread == NULL ) {
@@ -53,7 +54,6 @@ int pthread_getschedparam(
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
- _Thread_queue_Context_initialize( &queue_context );
_Thread_Wait_acquire_critical( the_thread, &queue_context );
*policy = api->Attributes.schedpolicy;
diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c
index 14ea1cd7f6..4da2ebf2a8 100644
--- a/cpukit/posix/src/pthreadsetschedparam.c
+++ b/cpukit/posix/src/pthreadsetschedparam.c
@@ -138,13 +138,14 @@ int pthread_setschedparam(
return error;
}
+ _Thread_queue_Context_initialize( &queue_context );
+ _Thread_queue_Context_clear_priority_updates( &queue_context );
the_thread = _Thread_Get( thread, &queue_context.Lock_context.Lock_context );
if ( the_thread == NULL ) {
return ESRCH;
}
- _Thread_queue_Context_clear_priority_updates( &queue_context );
_Thread_Wait_acquire_critical( the_thread, &queue_context );
error = _POSIX_Set_sched_param(
the_thread,
diff --git a/cpukit/posix/src/pthreadsetschedprio.c b/cpukit/posix/src/pthreadsetschedprio.c
index 16b6f3f585..ff7bd5c271 100644
--- a/cpukit/posix/src/pthreadsetschedprio.c
+++ b/cpukit/posix/src/pthreadsetschedprio.c
@@ -27,13 +27,14 @@ int pthread_setschedprio( pthread_t thread, int prio )
Priority_Control new_priority;
bool valid;
+ _Thread_queue_Context_initialize( &queue_context );
+ _Thread_queue_Context_clear_priority_updates( &queue_context );
the_thread = _Thread_Get( thread, &queue_context.Lock_context.Lock_context );
if ( the_thread == NULL ) {
return ESRCH;
}
- _Thread_queue_Context_clear_priority_updates( &queue_context );
_Thread_Wait_acquire_critical( the_thread, &queue_context );
scheduler = _Thread_Scheduler_get_home( the_thread );