Changeset 9b1f5678 in rtems


Ignore:
Timestamp:
Aug 22, 1997, 7:11:02 PM (23 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
8affd6f1
Parents:
799a5b9
Message:

Fixed infinite recursion bug in PTHREAD_MUTEX_INITIALIZER.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/posix/src/mutex.c

    r799a5b9 r9b1f5678  
    231231    return EINVAL;
    232232
    233   /* EBUSY if *mutex is a valid id */
    234 
    235   mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
    236   switch ( location ) {
    237     case OBJECTS_ERROR:
    238       break;
    239     case OBJECTS_REMOTE:
    240     case OBJECTS_LOCAL:
    241       _Thread_Enable_dispatch();
    242       return EBUSY;
    243   };
     233  /* avoid infinite recursion on call to this routine in _POSIX_Mutex_Get */
     234
     235  if ( *mutex != PTHREAD_MUTEX_INITIALIZER ) {
     236
     237    /* EBUSY if *mutex is a valid id */
     238
     239    mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
     240    switch ( location ) {
     241      case OBJECTS_ERROR:
     242        break;
     243      case OBJECTS_REMOTE:
     244      case OBJECTS_LOCAL:
     245        _Thread_Enable_dispatch();
     246        return EBUSY;
     247    }
     248  }
    244249 
    245250  if ( !the_attr->is_initialized )
  • cpukit/posix/src/mutex.c

    r799a5b9 r9b1f5678  
    231231    return EINVAL;
    232232
    233   /* EBUSY if *mutex is a valid id */
    234 
    235   mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
    236   switch ( location ) {
    237     case OBJECTS_ERROR:
    238       break;
    239     case OBJECTS_REMOTE:
    240     case OBJECTS_LOCAL:
    241       _Thread_Enable_dispatch();
    242       return EBUSY;
    243   };
     233  /* avoid infinite recursion on call to this routine in _POSIX_Mutex_Get */
     234
     235  if ( *mutex != PTHREAD_MUTEX_INITIALIZER ) {
     236
     237    /* EBUSY if *mutex is a valid id */
     238
     239    mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
     240    switch ( location ) {
     241      case OBJECTS_ERROR:
     242        break;
     243      case OBJECTS_REMOTE:
     244      case OBJECTS_LOCAL:
     245        _Thread_Enable_dispatch();
     246        return EBUSY;
     247    }
     248  }
    244249 
    245250  if ( !the_attr->is_initialized )
Note: See TracChangeset for help on using the changeset viewer.