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:
Brian Feldman 2004-10-31 05:03:50 +00:00
parent d88642fe52
commit 64926afd50
2 changed files with 2 additions and 16 deletions

View File

@ -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:

View File

@ -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: