From a0b94685cd30e1ddae4572156da07b4fd9ee6a1b Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 14 May 1999 14:43:53 +0000 Subject: Removed check for initialized ID at request of Rosimildo DaSilva who encountered random failures in his port of omniORB2. --- cpukit/posix/src/mutex.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'cpukit') diff --git a/cpukit/posix/src/mutex.c b/cpukit/posix/src/mutex.c index 10a38a06e5..f5a817bcb8 100644 --- a/cpukit/posix/src/mutex.c +++ b/cpukit/posix/src/mutex.c @@ -234,6 +234,28 @@ int pthread_mutex_init( if ( !mutex ) return EINVAL; + /* + * This code should eventually be removed. + * + * Although the POSIX specification says: + * + * "Attempting to initialize an already initialized mutex results + * in undefined behavior." + * + * Trying to keep the caller from doing the create when *mutex + * is actually a valid ID causes grief. All it takes is the wrong + * value in an uninitialized variable to make this fail. As best + * I can tell, RTEMS was the only pthread implementation to choose + * this option for "undefined behavior" and doing so has created + * portability problems. In particular, Rosimildo DaSilva + * saw seemingly random failures in the + * RTEMS port of omniORB2 when this code was enabled. + * + * Joel Sherrill 14 May 1999 + */ + + +#if 0 /* avoid infinite recursion on call to this routine in _POSIX_Mutex_Get */ if ( *mutex != PTHREAD_MUTEX_INITIALIZER ) { @@ -250,6 +272,7 @@ int pthread_mutex_init( return EBUSY; } } +#endif if ( !the_attr->is_initialized ) return EINVAL; -- cgit v1.2.3