summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/include/rtems/posix/pthreadimpl.h
diff options
context:
space:
mode:
authorJennifer Averett <jennifer.averett@oarcorp.com>2014-01-31 08:54:45 -0600
committerJennifer Averett <jennifer.averett@oarcorp.com>2014-03-07 09:10:33 -0600
commit185e46f6a05295755f0f4522cf44c93ec8cbd7d1 (patch)
tree05571a7fb077cf768913b7403a834baee89ab07c /cpukit/posix/include/rtems/posix/pthreadimpl.h
parentrtems: Add Classic API get and set affinity methods. (diff)
downloadrtems-185e46f6a05295755f0f4522cf44c93ec8cbd7d1.tar.bz2
posix: Add POSIX thread affinity attribute support.
With the addition of pthread affinity information in pthread_attr_t, the existing code for pthread_attr_t had to be adjusted.
Diffstat (limited to 'cpukit/posix/include/rtems/posix/pthreadimpl.h')
-rw-r--r--cpukit/posix/include/rtems/posix/pthreadimpl.h69
1 files changed, 68 insertions, 1 deletions
diff --git a/cpukit/posix/include/rtems/posix/pthreadimpl.h b/cpukit/posix/include/rtems/posix/pthreadimpl.h
index a65f849c7a..c4ace76d0e 100644
--- a/cpukit/posix/include/rtems/posix/pthreadimpl.h
+++ b/cpukit/posix/include/rtems/posix/pthreadimpl.h
@@ -24,6 +24,7 @@
#include <rtems/posix/threadsup.h>
#include <rtems/score/objectimpl.h>
#include <rtems/score/thread.h>
+#include <rtems/score/assert.h>
#ifdef __cplusplus
extern "C" {
@@ -48,7 +49,7 @@ POSIX_EXTERN Objects_Information _POSIX_Threads_Information;
/**
* This variable contains the default POSIX Thread attributes.
*/
-extern const pthread_attr_t _POSIX_Threads_Default_attributes;
+extern pthread_attr_t _POSIX_Threads_Default_attributes;
/**
* When the user configures a set of POSIX API initialization threads,
@@ -77,6 +78,23 @@ void _POSIX_Threads_Manager_initialization(void);
RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate( void );
/**
+ * @brief Copy POSIX Thread attribute structure.
+ *
+ * This routine copies the attr2 thread attribute structure
+ * to the attr1 Thread Attribute structure.
+ *
+ * @param[in] dst_attr is a pointer to the thread attribute
+ * structure to copy into.
+ *
+ * @param[out] src_attr is a pointer to the thread attribute
+ * structure to copy from.
+ */
+RTEMS_INLINE_ROUTINE void _POSIX_Threads_Copy_attributes(
+ pthread_attr_t *dst_attr,
+ const pthread_attr_t *src_attr
+);
+
+/**
* @brief Free POSIX control block.
*
* This routine frees a pthread control block to the
@@ -110,6 +128,15 @@ RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Get(
);
/**
+ * @brief POSIX threads initialize user threads body.
+ *
+ * This routine initializes the thread attributes structure.
+ */
+RTEMS_INLINE_ROUTINE void _POSIX_Threads_Initialize_attributes(
+ pthread_attr_t *attr
+);
+
+/**
* @brief Check if a POSIX thread control block is NULL.
*
* This function returns @c TRUE if the_pthread is @c NULL and @c FALSE
@@ -177,6 +204,14 @@ int _POSIX_Thread_Translate_sched_param(
);
/*
+ * rtems_pthread_attribute_compare
+ */
+int rtems_pthread_attribute_compare(
+ const pthread_attr_t *attr1,
+ const pthread_attr_t *attr2
+);
+
+/*
* _POSIX_Threads_Allocate
*/
@@ -186,6 +221,24 @@ RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate( void )
}
/*
+ * _POSIX_Threads_Copy_attributes
+ */
+
+RTEMS_INLINE_ROUTINE void _POSIX_Threads_Copy_attributes(
+ pthread_attr_t *dst_attr,
+ const pthread_attr_t *src_attr
+)
+{
+ *dst_attr = *src_attr;
+#if defined(__RTEMS_HAVE_SYS_CPUSET_H__)
+ _Assert(
+ dst_attr->affinitysetsize == sizeof(dst_attr->affinitysetpreallocated)
+ );
+ dst_attr->affinityset = &dst_attr->affinitysetpreallocated;
+#endif
+}
+
+/*
* _POSIX_Threads_Free
*/
@@ -210,6 +263,20 @@ RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Get (
}
/*
+ * _POSIX_Threads_Initialize_attributes
+ */
+
+RTEMS_INLINE_ROUTINE void _POSIX_Threads_Initialize_attributes(
+ pthread_attr_t *attr
+)
+{
+ _POSIX_Threads_Copy_attributes(
+ attr,
+ &_POSIX_Threads_Default_attributes
+ );
+}
+
+/*
* _POSIX_Threads_Is_null
*/