summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/pthreadcreate.c
diff options
context:
space:
mode:
authorJennifer Averett <jennifer.averett@oarcorp.com>2014-03-19 15:21:15 -0500
committerJennifer Averett <jennifer.averett@oarcorp.com>2014-04-03 10:48:57 -0500
commite045fb6c60a495aafd2ced0fd756862a66e98ce3 (patch)
treea6773e1a8483e0ed1ad823024ce6bae25232fb4d /cpukit/posix/src/pthreadcreate.c
parentposix: Modified pthread init to use cpuset default. (diff)
downloadrtems-e045fb6c60a495aafd2ced0fd756862a66e98ce3.tar.bz2
posix: Move affinity from thread to scheduler.
Diffstat (limited to 'cpukit/posix/src/pthreadcreate.c')
-rw-r--r--cpukit/posix/src/pthreadcreate.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index 8d031335cc..8db6948830 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -32,6 +32,8 @@
#include <rtems/score/apimutex.h>
#include <rtems/score/stackimpl.h>
#include <rtems/score/watchdogimpl.h>
+#include <rtems/score/schedulerimpl.h>
+
static inline size_t _POSIX_Threads_Ensure_minimum_stack (
size_t size
@@ -139,8 +141,8 @@ int pthread_create(
#if defined(RTEMS_SMP)
#if __RTEMS_HAVE_SYS_CPUSET_H__
- rc = _CPU_set_Is_valid( the_attr->affinityset, the_attr->affinitysetsize );
- if ( rc != 0 )
+ status = _CPU_set_Is_valid( the_attr->affinityset, the_attr->affinitysetsize );
+ if (!status )
return EINVAL;
#endif
#endif
@@ -191,8 +193,16 @@ int pthread_create(
#if defined(RTEMS_SMP)
#if __RTEMS_HAVE_SYS_CPUSET_H__
- the_thread->affinity.setsize = the_attr->affinitysetsize;
- *the_thread->affinity.set = *the_attr->affinityset;
+ status = _Scheduler_Set_affinity(
+ the_thread,
+ attr->affinitysetsize,
+ attr->affinityset
+ );
+ if ( !status ) {
+ _POSIX_Threads_Free( the_thread );
+ _RTEMS_Unlock_allocator();
+ return EINVAL;
+ }
#endif
#endif