diff options
author | Jennifer Averett <jennifer.averett@oarcorp.com> | 2014-03-19 15:21:15 -0500 |
---|---|---|
committer | Jennifer Averett <jennifer.averett@oarcorp.com> | 2014-04-03 10:48:57 -0500 |
commit | e045fb6c60a495aafd2ced0fd756862a66e98ce3 (patch) | |
tree | a6773e1a8483e0ed1ad823024ce6bae25232fb4d /cpukit/posix/src/pthreadsetaffinitynp.c | |
parent | posix: Modified pthread init to use cpuset default. (diff) | |
download | rtems-e045fb6c60a495aafd2ced0fd756862a66e98ce3.tar.bz2 |
posix: Move affinity from thread to scheduler.
Diffstat (limited to 'cpukit/posix/src/pthreadsetaffinitynp.c')
-rw-r--r-- | cpukit/posix/src/pthreadsetaffinitynp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cpukit/posix/src/pthreadsetaffinitynp.c b/cpukit/posix/src/pthreadsetaffinitynp.c index fc2194db30..d150b409a1 100644 --- a/cpukit/posix/src/pthreadsetaffinitynp.c +++ b/cpukit/posix/src/pthreadsetaffinitynp.c @@ -28,6 +28,7 @@ #include <rtems/posix/priorityimpl.h> #include <rtems/score/threadimpl.h> #include <rtems/score/cpusetimpl.h> +#include <rtems/score/schedulerimpl.h> int pthread_setaffinity_np( pthread_t id, @@ -37,23 +38,22 @@ int pthread_setaffinity_np( Objects_Locations location; POSIX_API_Control *api; Thread_Control *the_thread; - int error; + bool ok; if ( !cpuset ) return EFAULT; - error = _CPU_set_Is_valid( cpuset, cpusetsize ); - if ( error != 0 ) - return EINVAL; - the_thread = _Thread_Get( id, &location ); switch ( location ) { case OBJECTS_LOCAL: api = the_thread->API_Extensions[ THREAD_API_POSIX ]; - CPU_COPY( the_thread->affinity.set, cpuset ); - CPU_COPY( api->Attributes.affinityset, cpuset ); + ok = _Scheduler_Set_affinity( the_thread, cpusetsize, cpuset ); + if (ok) + CPU_COPY( api->Attributes.affinityset, cpuset ); _Objects_Put( &the_thread->Object ); + if (!ok) + return EINVAL; return 0; break; |