[PATCH 04/15] posix: Remove dead code and shrink comment

Gedare Bloom gedare at rtems.org
Fri May 20 14:05:52 UTC 2016


Calling out to Sambeet to note that this patch is removing a comment
about OmniORB that may be relevant to his work this summer.

On Fri, May 20, 2016 at 9:33 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> ---
>  cpukit/posix/src/mutexinit.c | 38 +++-----------------------------------
>  1 file changed, 3 insertions(+), 35 deletions(-)
>
> diff --git a/cpukit/posix/src/mutexinit.c b/cpukit/posix/src/mutexinit.c
> index 1888699..8de76d0 100644
> --- a/cpukit/posix/src/mutexinit.c
> +++ b/cpukit/posix/src/mutexinit.c
> @@ -46,49 +46,17 @@ int pthread_mutex_init(
>      return EINVAL;
>
>    /*
> -   *  This code should eventually be removed.
> -   *
> -   *  Although the POSIX specification says:
> +   *  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
> -   *  <rdasilva at connecttel.com> saw seemingly random failures in the
> -   *  RTEMS port of omniORB2 when this code was enabled.
> +   *  value in an uninitialized variable to make this fail.
>     *
> -   *  Joel Sherrill <joel at OARcorp.com>     14 May 1999
> -   *  NOTE: Be careful to avoid infinite recursion on call to this
> -   *        routine in _POSIX_Mutex_Get.
> +   *  Thus, we do not look at *mutex.
>     */
> -  #if 0
> -  {
> -    POSIX_Mutex_Control *mutex_in_use;
> -    Objects_Locations    location;
> -
> -    if ( *mutex != PTHREAD_MUTEX_INITIALIZER ) {
> -
> -      /* EBUSY if *mutex is a valid id */
> -
> -      mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
> -      switch ( location ) {
> -        case OBJECTS_LOCAL:
> -          _Objects_Put( &mutex_in_use->Object );
> -          return EBUSY;
> -        #if defined(RTEMS_MULTIPROCESSING)
> -          case OBJECTS_REMOTE:
> -        #endif
> -        case OBJECTS_ERROR:
> -          break;
> -      }
> -    }
> -  }
> -  #endif
>
>    if ( !the_attr->is_initialized )
>      return EINVAL;
> --
> 1.8.4.5
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list