summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJennifer Averett <jennifer.averett@oarcorp.com>2014-03-19 09:50:51 -0500
committerJennifer Averett <jennifer.averett@oarcorp.com>2014-04-03 10:48:57 -0500
commit7205189ce31cd2aa65085662af89c9c6d8214980 (patch)
tree66eeabdbd7fc5ca9f338eae00f105d1eec2a4bb0
parentrtems: Move affinity from thread to scheduler. (diff)
downloadrtems-7205189ce31cd2aa65085662af89c9c6d8214980.tar.bz2
posix: Modified pthread init to use cpuset default.
-rw-r--r--cpukit/posix/src/pthread.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c
index 512cd70c8f..a688b7e808 100644
--- a/cpukit/posix/src/pthread.c
+++ b/cpukit/posix/src/pthread.c
@@ -41,6 +41,8 @@
#include <rtems/posix/keyimpl.h>
#include <rtems/posix/time.h>
#include <rtems/score/timespec.h>
+#include <rtems/score/cpusetimpl.h>
+#include <rtems/score/assert.h>
/*
* The default pthreads attributes structure.
@@ -370,24 +372,18 @@ User_extensions_Control _POSIX_Threads_User_extensions = {
void _POSIX_Threads_Manager_initialization(void)
{
#if defined(__RTEMS_HAVE_SYS_CPUSET_H__)
+ const CPU_set_Control *affinity;
pthread_attr_t *attr;
- int i;
- int max_cpus = 1;
/* Initialize default attribute. */
attr = &_POSIX_Threads_Default_attributes;
- /* We do not support a cpu count over CPU_SETSIZE */
- max_cpus = _SMP_Get_processor_count();
- assert( max_cpus <= CPU_SETSIZE );
-
- /* Initialize the affinity to be the set of all available CPU's */
+ /* Initialize the affinity to be the default cpu set for the system */
+ affinity = _CPU_set_Default();
+ _Assert( affinity->setsize == sizeof( attr->affinitysetpreallocated ) );
attr->affinityset = &attr->affinitysetpreallocated;
- attr->affinitysetsize = sizeof( *attr->affinityset );
- CPU_ZERO_S( attr->affinitysetsize, &attr->affinitysetpreallocated );
-
- for (i=0; i<max_cpus; i++)
- CPU_SET_S(i, attr->affinitysetsize, attr->affinityset );
+ attr->affinitysetsize = affinity->setsize;
+ CPU_COPY( attr->affinityset, affinity->set );
#endif
_Objects_Initialize_information(