mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 23:23:13 +00:00
pthread_mutex_init: added error messages for NULL mutex and EBUSY
This commit is contained in:
@@ -219,12 +219,28 @@ int pthread_mutex_init(
|
|||||||
CORE_mutex_Attributes *the_mutex_attr;
|
CORE_mutex_Attributes *the_mutex_attr;
|
||||||
const pthread_mutexattr_t *the_attr;
|
const pthread_mutexattr_t *the_attr;
|
||||||
CORE_mutex_Disciplines the_discipline;
|
CORE_mutex_Disciplines the_discipline;
|
||||||
|
register POSIX_Mutex_Control *mutex_in_use;
|
||||||
|
Objects_Locations location;
|
||||||
|
|
||||||
if ( attr ) the_attr = attr;
|
if ( attr ) the_attr = attr;
|
||||||
else the_attr = &_POSIX_Mutex_Default_attributes;
|
else the_attr = &_POSIX_Mutex_Default_attributes;
|
||||||
|
|
||||||
/* XXX need to check for NULL mutex */
|
/* Check for NULL mutex */
|
||||||
/* XXX EBUSY if *mutex is a valid id */
|
|
||||||
|
if ( !mutex )
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
|
/* EBUSY if *mutex is a valid id */
|
||||||
|
|
||||||
|
mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
|
||||||
|
switch ( location ) {
|
||||||
|
case OBJECTS_ERROR:
|
||||||
|
break;
|
||||||
|
case OBJECTS_REMOTE:
|
||||||
|
case OBJECTS_LOCAL:
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
|
return EBUSY;
|
||||||
|
};
|
||||||
|
|
||||||
if ( !the_attr->is_initialized )
|
if ( !the_attr->is_initialized )
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|||||||
@@ -219,12 +219,28 @@ int pthread_mutex_init(
|
|||||||
CORE_mutex_Attributes *the_mutex_attr;
|
CORE_mutex_Attributes *the_mutex_attr;
|
||||||
const pthread_mutexattr_t *the_attr;
|
const pthread_mutexattr_t *the_attr;
|
||||||
CORE_mutex_Disciplines the_discipline;
|
CORE_mutex_Disciplines the_discipline;
|
||||||
|
register POSIX_Mutex_Control *mutex_in_use;
|
||||||
|
Objects_Locations location;
|
||||||
|
|
||||||
if ( attr ) the_attr = attr;
|
if ( attr ) the_attr = attr;
|
||||||
else the_attr = &_POSIX_Mutex_Default_attributes;
|
else the_attr = &_POSIX_Mutex_Default_attributes;
|
||||||
|
|
||||||
/* XXX need to check for NULL mutex */
|
/* Check for NULL mutex */
|
||||||
/* XXX EBUSY if *mutex is a valid id */
|
|
||||||
|
if ( !mutex )
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
|
/* EBUSY if *mutex is a valid id */
|
||||||
|
|
||||||
|
mutex_in_use = _POSIX_Mutex_Get( mutex, &location );
|
||||||
|
switch ( location ) {
|
||||||
|
case OBJECTS_ERROR:
|
||||||
|
break;
|
||||||
|
case OBJECTS_REMOTE:
|
||||||
|
case OBJECTS_LOCAL:
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
|
return EBUSY;
|
||||||
|
};
|
||||||
|
|
||||||
if ( !the_attr->is_initialized )
|
if ( !the_attr->is_initialized )
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|||||||
Reference in New Issue
Block a user