After careful consideration (and a brief discussion with attilio@), change
the semantics of pthread_mutex_islocked_np() to return true if and only if the mutex is held by the current thread. Obviously, change the regression test to match. MFC after: 2 weeks
This commit is contained in:
parent
3f0bfcccfd
commit
fcd61d9141
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=175969
@ -877,5 +877,5 @@ _pthread_mutex_islocked_np(pthread_mutex_t *mutex)
|
||||
if (__predict_false(ret))
|
||||
return (ret);
|
||||
}
|
||||
return ((*mutex)->m_qe.tqe_prev != NULL);
|
||||
return ((*mutex)->m_lock.m_owner == TID(curthread));
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ thread(void *arg)
|
||||
{
|
||||
pthread_mutex_t *mtx = arg;
|
||||
|
||||
if (pthread_mutex_islocked_np(mtx) == 0) {
|
||||
printf("pthread_mutex_islocked_np() returned zero\n"
|
||||
if (pthread_mutex_islocked_np(mtx) != 0) {
|
||||
printf("pthread_mutex_islocked_np() returned non-zero\n"
|
||||
"for a mutex held by another thread\n");
|
||||
exit(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user