From 2df7fcff883856cd2fa8a56e9c509a0674bfb01a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 14 Jun 2016 11:45:22 +0200 Subject: posix: _POSIX_Mutex_Default_attributes Make _POSIX_Mutex_Default_attributes constant and independent of the scheduler instance. Use INT_MAX to indicate the default ceiling priority. --- cpukit/posix/src/mutex.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'cpukit/posix/src/mutex.c') diff --git a/cpukit/posix/src/mutex.c b/cpukit/posix/src/mutex.c index 22b14c0001..3e34dffb3d 100644 --- a/cpukit/posix/src/mutex.c +++ b/cpukit/posix/src/mutex.c @@ -18,21 +18,25 @@ #include "config.h" #endif -#include -#include #include -#include #include #include -#include -#include #include -#include +#include Objects_Information _POSIX_Mutex_Information; -pthread_mutexattr_t _POSIX_Mutex_Default_attributes; +const pthread_mutexattr_t _POSIX_Mutex_Default_attributes = { +#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) + .type = PTHREAD_MUTEX_DEFAULT, +#endif + .is_initialized = true, + .process_shared = PTHREAD_PROCESS_PRIVATE, + .prio_ceiling = INT_MAX, + .protocol = PTHREAD_PRIO_NONE, + .recursive = false +}; /* * _POSIX_Mutex_Manager_initialization @@ -47,21 +51,6 @@ pthread_mutexattr_t _POSIX_Mutex_Default_attributes; static void _POSIX_Mutex_Manager_initialization(void) { - pthread_mutexattr_t *default_attr = &_POSIX_Mutex_Default_attributes; - - /* - * Since the maximum priority is run-time configured, this - * structure cannot be initialized statically. - */ - default_attr->is_initialized = true; - default_attr->process_shared = PTHREAD_PROCESS_PRIVATE; - default_attr->prio_ceiling = POSIX_SCHEDULER_MAXIMUM_PRIORITY; - default_attr->protocol = PTHREAD_PRIO_NONE; - default_attr->recursive = false; - #if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) - default_attr->type = PTHREAD_MUTEX_DEFAULT; - #endif - /* * Initialize the POSIX mutex object class information structure. */ -- cgit v1.2.3