_mutex_trylock():

* The loop is unnecessary, since the call doesn't block anyway, so it can't
  be interrupted.
* Set the holder, if KDEBUG is enabled. Otherwise the panic() in
  recursive_lock_unlock() would be triggered.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29556 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-03-16 03:34:08 +00:00
parent 0c9a35e882
commit 4a92b6134f

View File

@ -154,11 +154,13 @@ mutex_destroy(mutex *mutex)
status_t
_mutex_trylock(mutex *mutex)
{
status_t status;
do {
status = acquire_sem_etc((sem_id)mutex->waiters, 1, B_RELATIVE_TIMEOUT,
0);
} while (status == B_INTERRUPTED);
status_t status = acquire_sem_etc((sem_id)mutex->waiters, 1,
B_RELATIVE_TIMEOUT, 0);
#if KDEBUG
if (status == B_OK)
mutex->holder = find_thread(NULL);
#endif
return status;
}