forked from Imagelibrary/rtems
Fixed infinite recursion bug in PTHREAD_MUTEX_INITIALIZER.
This commit is contained in:
@@ -230,6 +230,10 @@ int pthread_mutex_init(
|
|||||||
if ( !mutex )
|
if ( !mutex )
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
|
/* avoid infinite recursion on call to this routine in _POSIX_Mutex_Get */
|
||||||
|
|
||||||
|
if ( *mutex != PTHREAD_MUTEX_INITIALIZER ) {
|
||||||
|
|
||||||
/* EBUSY if *mutex is a valid id */
|
/* EBUSY if *mutex is a valid id */
|
||||||
|
|
||||||
mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
|
mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
|
||||||
@@ -240,7 +244,8 @@ int pthread_mutex_init(
|
|||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
return EBUSY;
|
return EBUSY;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( !the_attr->is_initialized )
|
if ( !the_attr->is_initialized )
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|||||||
@@ -230,6 +230,10 @@ int pthread_mutex_init(
|
|||||||
if ( !mutex )
|
if ( !mutex )
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
|
/* avoid infinite recursion on call to this routine in _POSIX_Mutex_Get */
|
||||||
|
|
||||||
|
if ( *mutex != PTHREAD_MUTEX_INITIALIZER ) {
|
||||||
|
|
||||||
/* EBUSY if *mutex is a valid id */
|
/* EBUSY if *mutex is a valid id */
|
||||||
|
|
||||||
mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
|
mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
|
||||||
@@ -240,7 +244,8 @@ int pthread_mutex_init(
|
|||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
_Thread_Enable_dispatch();
|
_Thread_Enable_dispatch();
|
||||||
return EBUSY;
|
return EBUSY;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( !the_attr->is_initialized )
|
if ( !the_attr->is_initialized )
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|||||||
Reference in New Issue
Block a user