Added a LockWithTimeout() method to the RecursiveLock class.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6353 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
e1431e96f3
commit
8364cf0a90
@ -131,7 +131,7 @@ class RecursiveLock {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t Lock()
|
status_t LockWithTimeout(bigtime_t timeout)
|
||||||
{
|
{
|
||||||
thread_id thread = find_thread(NULL);
|
thread_id thread = find_thread(NULL);
|
||||||
if (thread == fOwner) {
|
if (thread == fOwner) {
|
||||||
@ -145,7 +145,7 @@ class RecursiveLock {
|
|||||||
status = B_OK;
|
status = B_OK;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
status = acquire_sem(fSemaphore);
|
status = acquire_sem_etc(fSemaphore, 1, B_RELATIVE_TIMEOUT, timeout);
|
||||||
|
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
fOwner = thread;
|
fOwner = thread;
|
||||||
@ -155,6 +155,11 @@ class RecursiveLock {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status_t Lock()
|
||||||
|
{
|
||||||
|
return LockWithTimeout(B_INFINITE_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
status_t Unlock()
|
status_t Unlock()
|
||||||
{
|
{
|
||||||
thread_id thread = find_thread(NULL);
|
thread_id thread = find_thread(NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user