Added InitCheck() method.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29487 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b32211a457
commit
f451e14bc2
@ -17,6 +17,8 @@ class BLocker {
|
||||
BLocker(const char* name, bool benaphoreStyle);
|
||||
virtual ~BLocker();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
bool Lock(void);
|
||||
status_t LockWithTimeout(bigtime_t timeout);
|
||||
void Unlock(void);
|
||||
|
@ -93,6 +93,13 @@ BLocker::~BLocker()
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BLocker::InitCheck() const
|
||||
{
|
||||
return fSemaphoreID >= 0 ? B_OK : fSemaphoreID;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
BLocker::Lock(void)
|
||||
{
|
||||
@ -141,7 +148,7 @@ BLocker::Unlock(void)
|
||||
release_sem(fSemaphoreID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -206,7 +213,7 @@ BLocker::InitLocker(const char *name, bool benaphore)
|
||||
|
||||
// The lock is currently not acquired so there is no owner.
|
||||
fLockOwner = B_ERROR;
|
||||
|
||||
|
||||
// The lock is currently not acquired so the recursive count is zero.
|
||||
fRecursiveCount = 0;
|
||||
}
|
||||
@ -272,7 +279,7 @@ BLocker::AcquireLock(bigtime_t timeout, status_t *error)
|
||||
}
|
||||
}
|
||||
|
||||
// If the lock has successfully been acquired.
|
||||
// If the lock has successfully been acquired.
|
||||
if (status == B_OK) {
|
||||
// Set the lock owner to this thread and increment the recursive count
|
||||
// by one. The recursive count is incremented because one more Unlock()
|
||||
|
Loading…
x
Reference in New Issue
Block a user