[rtems commit] pthreadcreate.c: Fix bug where attr used instead of the_attr

Joel Sherrill joel at rtems.org
Thu Apr 3 19:55:59 UTC 2014


Module:    rtems
Branch:    master
Commit:    68c156aea71718a739706245b71d43b8358058ff
Changeset: http://git.rtems.org/rtems/commit/?id=68c156aea71718a739706245b71d43b8358058ff

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Thu Apr  3 15:03:42 2014 -0500

pthreadcreate.c: Fix bug where attr used instead of the_attr

---

 cpukit/posix/src/pthreadcreate.c |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index 8db6948..8ae7904 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -9,7 +9,8 @@
  *  16.1.2 Thread Creation, P1003.1c/Draft 10, p. 144
  */
 
-/*  COPYRIGHT (c) 1989-2008.
+/*
+ *  COPYRIGHT (c) 1989-2014.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -142,7 +143,7 @@ int pthread_create(
 #if defined(RTEMS_SMP)
 #if __RTEMS_HAVE_SYS_CPUSET_H__
   status = _CPU_set_Is_valid( the_attr->affinityset, the_attr->affinitysetsize );
-  if (!status )
+  if ( !status )
     return EINVAL;
 #endif
 #endif
@@ -191,19 +192,17 @@ int pthread_create(
     return EAGAIN;
   }
 
-#if defined(RTEMS_SMP)
-#if __RTEMS_HAVE_SYS_CPUSET_H__
-   status = _Scheduler_Set_affinity( 
-     the_thread,  
-     attr->affinitysetsize, 
-     attr->affinityset 
+#if defined(RTEMS_SMP) && __RTEMS_HAVE_SYS_CPUSET_H__
+   status = _Scheduler_Set_affinity(
+     the_thread,
+     the_attr->affinitysetsize,
+     the_attr->affinityset
    );
-  if ( !status ) {
-    _POSIX_Threads_Free( the_thread );
-    _RTEMS_Unlock_allocator();
-    return EINVAL;
-  }
-#endif
+   if ( !status ) {
+     _POSIX_Threads_Free( the_thread );
+     _RTEMS_Unlock_allocator();
+     return EINVAL;
+   }
 #endif
 
   /*




More information about the vc mailing list