* minor cleanup

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19526 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2006-12-15 22:41:35 +00:00
parent d881c6ba5c
commit 2ba6b3a649

View File

@ -210,7 +210,8 @@ MultiLocker::WriteLock()
if (readers > 0) {
//readers hold the lock - acquire fWriteSem
locked = (acquire_sem_etc(fWriteSem, readers, B_DO_NOT_RESCHEDULE,
locked = (acquire_sem_etc(fWriteSem, readers,
B_DO_NOT_RESCHEDULE,
B_INFINITE_TIMEOUT) == B_OK);
}
if (locked) {
@ -301,7 +302,8 @@ MultiLocker::WriteUnlock()
//increment fReadCount by a large number
//this will let new readers acquire the read lock
//retrieve the number of current waiters
int32 readersWaiting = atomic_add(&fReadCount, LARGE_NUMBER) + LARGE_NUMBER;
int32 readersWaiting = atomic_add(&fReadCount, LARGE_NUMBER)
+ LARGE_NUMBER;
if (readersWaiting > 0) {
//readers are waiting to acquire the lock
@ -413,8 +415,10 @@ MultiLocker::IsReadLocked()
#if DEBUG
//determine if the lock is actually held
thread_id thread = find_thread(NULL);
if (fDebugArray[thread % fMaxThreads] > 0) locked = true;
else locked = false;
if (fDebugArray[thread % fMaxThreads] > 0)
locked = true;
else
locked = false;
#endif
return locked;