Make pthread_mutex_trylock(3) return EBUSY on failure, as all software
packages expect and seems to be most correct according to the slightly- ambiguous standards. MFC after: 1 month Corroborated by: POSIX <http://tinyurl.com/4uvub> Reviewed by: silence on threads@
This commit is contained in:
parent
d88642fe52
commit
64926afd50
@ -911,14 +911,7 @@ mutex_self_trylock(struct pthread *curthread, pthread_mutex_t m)
|
||||
/* case PTHREAD_MUTEX_DEFAULT: */
|
||||
case PTHREAD_MUTEX_ERRORCHECK:
|
||||
case PTHREAD_MUTEX_NORMAL:
|
||||
/*
|
||||
* POSIX specifies that mutexes should return EDEADLK if a
|
||||
* recursive lock is detected.
|
||||
*/
|
||||
if (m->m_owner == curthread)
|
||||
ret = EDEADLK;
|
||||
else
|
||||
ret = EBUSY;
|
||||
ret = EBUSY;
|
||||
break;
|
||||
|
||||
case PTHREAD_MUTEX_RECURSIVE:
|
||||
|
@ -911,14 +911,7 @@ mutex_self_trylock(struct pthread *curthread, pthread_mutex_t m)
|
||||
/* case PTHREAD_MUTEX_DEFAULT: */
|
||||
case PTHREAD_MUTEX_ERRORCHECK:
|
||||
case PTHREAD_MUTEX_NORMAL:
|
||||
/*
|
||||
* POSIX specifies that mutexes should return EDEADLK if a
|
||||
* recursive lock is detected.
|
||||
*/
|
||||
if (m->m_owner == curthread)
|
||||
ret = EDEADLK;
|
||||
else
|
||||
ret = EBUSY;
|
||||
ret = EBUSY;
|
||||
break;
|
||||
|
||||
case PTHREAD_MUTEX_RECURSIVE:
|
||||
|
Loading…
x
Reference in New Issue
Block a user