forked from Imagelibrary/rtems
posix: fix error return code for pthread_mutex_trylock
pthread_mutex_trylock() should return EBUSY if the mutex is already locked. The translations of CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED is EDEADLK which is correct for pthread_mutex_lock(). This fixes the translation for trylock. Closes #2170.
This commit is contained in:
@@ -37,5 +37,8 @@ int pthread_mutex_trylock(
|
|||||||
pthread_mutex_t *mutex
|
pthread_mutex_t *mutex
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return _POSIX_Mutex_Lock_support( mutex, false, THREAD_QUEUE_WAIT_FOREVER );
|
int r = _POSIX_Mutex_Lock_support( mutex, false, THREAD_QUEUE_WAIT_FOREVER );
|
||||||
|
if ( r == EDEADLK )
|
||||||
|
r = EBUSY;
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -580,8 +580,8 @@ The mutex has the protocol attribute of PTHREAD_PRIO_PROTECT and the
|
|||||||
priority of the calling thread is higher than the current priority
|
priority of the calling thread is higher than the current priority
|
||||||
ceiling.
|
ceiling.
|
||||||
|
|
||||||
@item EDEADLK
|
@item EBUSY
|
||||||
The current thread already owns the mutex.
|
The mutex is already locked.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user