summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/pthreadgetattrnp.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/posix/src/pthreadgetattrnp.c')
-rw-r--r--cpukit/posix/src/pthreadgetattrnp.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/cpukit/posix/src/pthreadgetattrnp.c b/cpukit/posix/src/pthreadgetattrnp.c
index bebf35e4d6..9df5bad38f 100644
--- a/cpukit/posix/src/pthreadgetattrnp.c
+++ b/cpukit/posix/src/pthreadgetattrnp.c
@@ -34,11 +34,12 @@ int pthread_getattr_np(
pthread_attr_t *attr
)
{
- Thread_Control *the_thread;
- ISR_lock_Context lock_context;
- POSIX_API_Control *api;
- const Scheduler_Control *scheduler;
- bool ok;
+ Thread_Control *the_thread;
+ ISR_lock_Context lock_context;
+ const POSIX_API_Control *api;
+ Thread_CPU_budget_algorithms budget_algorithm;
+ const Scheduler_Control *scheduler;
+ bool ok;
if ( attr == NULL ) {
return EINVAL;
@@ -56,10 +57,8 @@ int pthread_getattr_np(
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
- attr->is_initialized = true;
attr->stackaddr = the_thread->Start.Initial_stack.area;
attr->stacksize = the_thread->Start.Initial_stack.size;
- attr->contentionscope = PTHREAD_SCOPE_PROCESS;
if ( api->created_with_explicit_scheduler ) {
attr->inheritsched = PTHREAD_EXPLICIT_SCHED;
@@ -67,8 +66,6 @@ int pthread_getattr_np(
attr->inheritsched = PTHREAD_INHERIT_SCHED;
}
- attr->schedpolicy = api->schedpolicy;
-
scheduler = _Thread_Scheduler_get_home( the_thread );
attr->schedparam.sched_priority = _POSIX_Priority_From_core(
scheduler,
@@ -80,7 +77,6 @@ int pthread_getattr_np(
scheduler,
&attr->schedparam
);
- attr->cputime_clock_allowed = 1;
if ( _Thread_Is_joinable( the_thread ) ) {
attr->detachstate = PTHREAD_CREATE_JOINABLE;
@@ -96,6 +92,15 @@ int pthread_getattr_np(
attr->affinityset
);
+ budget_algorithm = the_thread->budget_algorithm;
+
_Thread_State_release( the_thread, &lock_context );
+
+ attr->is_initialized = true;
+ attr->contentionscope = PTHREAD_SCOPE_PROCESS;
+ attr->cputime_clock_allowed = 1;
+ attr->schedpolicy =
+ _POSIX_Thread_Translate_to_sched_policy( budget_algorithm );
+
return ok ? 0 : EINVAL;
}