Added optional locking timeouts to help stave off deadlocks

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2180 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2002-12-08 12:32:34 +00:00
parent 457c142fdf
commit a5dbd67b81
2 changed files with 6 additions and 3 deletions

View File

@ -103,9 +103,12 @@ BPoint DisplayDriver::GetHotSpot(void)
// Private Methods // Private Methods
//--------------------------------------------------------- //---------------------------------------------------------
void DisplayDriver::Lock(void) bool DisplayDriver::Lock(bigtime_t timeout) // defaults to B_INIFINITE_TIMEOUT
{ {
acquire_sem(lock_sem); // acquire_sem(lock_sem);
if(acquire_sem_etc(lock_sem,1,B_RELATIVE_TIMEOUT,timeout)!=B_NO_ERROR)
return false;
return true;
} }
void DisplayDriver::Unlock(void) void DisplayDriver::Unlock(void)

View File

@ -110,7 +110,7 @@ public:
BPoint GetHotSpot(void); BPoint GetHotSpot(void);
protected: protected:
void Lock(void); bool Lock(bigtime_t timeout=B_INFINITE_TIMEOUT);
void Unlock(void); void Unlock(void);
void SetDepthInternal(uint8 d); void SetDepthInternal(uint8 d);
void SetHeightInternal(uint16 h); void SetHeightInternal(uint16 h);