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.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/cpukit/posix/src/pthreadgetattrnp.c b/cpukit/posix/src/pthreadgetattrnp.c
index f71819f998..57c53183ed 100644
--- a/cpukit/posix/src/pthreadgetattrnp.c
+++ b/cpukit/posix/src/pthreadgetattrnp.c
@@ -26,32 +26,29 @@
#include <rtems/score/threadimpl.h>
int pthread_getattr_np(
- pthread_t id,
+ pthread_t thread,
pthread_attr_t *attr
)
{
- Objects_Locations location;
- POSIX_API_Control *api;
- Thread_Control *the_thread;
+ Thread_Control *the_thread;
+ ISR_lock_Context lock_context;
+ POSIX_API_Control *api;
- if ( !attr )
+ if ( attr == NULL ) {
return EINVAL;
+ }
- the_thread = _Thread_Get( id, &location );
- switch ( location ) {
-
- case OBJECTS_LOCAL:
- api = the_thread->API_Extensions[ THREAD_API_POSIX ];
- _POSIX_Threads_Copy_attributes( attr, &api->Attributes);
- _Objects_Put( &the_thread->Object );
- return 0;
+ the_thread = _Thread_Get_interrupt_disable( thread, &lock_context );
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- break;
+ if ( the_thread == NULL ) {
+ return ESRCH;
}
- return ESRCH;
+ _Thread_State_acquire_critical( the_thread, &lock_context );
+
+ api = the_thread->API_Extensions[ THREAD_API_POSIX ];
+ _POSIX_Threads_Copy_attributes( attr, &api->Attributes);
+
+ _Thread_State_release( the_thread, &lock_context );
+ return 0;
}