summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/mutexinit.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-06-29 23:19:28 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-06-29 23:19:28 +0000
commit290d2b79fefb3419fa84d72a5463cea134976581 (patch)
tree97069e1a59f85eea47ffe3803c88b6ca9f972138 /cpukit/posix/src/mutexinit.c
parent2009-06-29 Xi Yang <hiyangxi@gmail.com> (diff)
downloadrtems-290d2b79fefb3419fa84d72a5463cea134976581.tar.bz2
2009-06-29 Joel Sherrill <joel.sherrill@oarcorp.com>
* posix/src/killinfo.c, posix/src/mutexinit.c, posix/src/psignal.c, posix/src/psignalchecksignal.c, posix/src/pthread.c, posix/src/pthreadexit.c, posix/src/pthreadinitthreads.c: Remove includes of <assert.h> where possible. Make other uses conditional on ifdef RTEMS_DEBUG.
Diffstat (limited to 'cpukit/posix/src/mutexinit.c')
-rw-r--r--cpukit/posix/src/mutexinit.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/cpukit/posix/src/mutexinit.c b/cpukit/posix/src/mutexinit.c
index 5fe81d100b..353049a879 100644
--- a/cpukit/posix/src/mutexinit.c
+++ b/cpukit/posix/src/mutexinit.c
@@ -13,7 +13,6 @@
#include "config.h"
#endif
-#include <assert.h>
#include <errno.h>
#include <pthread.h>
@@ -50,7 +49,6 @@ int pthread_mutex_init(
else the_attr = &_POSIX_Mutex_Default_attributes;
/* Check for NULL mutex */
-
if ( !mutex )
return EINVAL;
@@ -98,18 +96,17 @@ int pthread_mutex_init(
return EINVAL;
/*
- * XXX: Be careful about attributes when global!!!
+ * We only support process private mutexes.
*/
-
- assert( the_attr->process_shared == PTHREAD_PROCESS_PRIVATE );
-
if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED )
return ENOSYS;
+ if ( the_attr->process_shared != PTHREAD_PROCESS_PRIVATE )
+ return EINVAL;
+
/*
* Determine the discipline of the mutex
*/
-
switch ( the_attr->protocol ) {
case PTHREAD_PRIO_NONE:
the_discipline = CORE_MUTEX_DISCIPLINES_FIFO;
@@ -127,6 +124,9 @@ int pthread_mutex_init(
if ( !_POSIX_Priority_Is_valid( the_attr->prio_ceiling ) )
return EINVAL;
+ /*
+ * Enter a dispatching critical section and begin to do the real work.
+ */
_Thread_Disable_dispatch();
the_mutex = _POSIX_Mutex_Allocate();
@@ -152,7 +152,6 @@ int pthread_mutex_init(
/*
* Must be initialized to unlocked.
*/
-
_CORE_mutex_Initialize(
&the_mutex->Mutex,
the_mutex_attr,