diff --git a/headers/os/support/Locker.h b/headers/os/support/Locker.h index 50aeb1a78d..b6605d0924 100644 --- a/headers/os/support/Locker.h +++ b/headers/os/support/Locker.h @@ -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); diff --git a/src/kits/support/Locker.cpp b/src/kits/support/Locker.cpp index 48c0b99dbb..0a25a21e70 100644 --- a/src/kits/support/Locker.cpp +++ b/src/kits/support/Locker.cpp @@ -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()