Changed locking scheme to allow for multiple acquisitions
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2682 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
77d6501f22
commit
0d831b179f
@ -36,7 +36,7 @@
|
||||
*/
|
||||
DisplayDriver::DisplayDriver(void)
|
||||
{
|
||||
_lock_sem=create_sem(1,"DisplayDriver Lock");
|
||||
_locker=new BLocker();
|
||||
|
||||
_buffer_depth=0;
|
||||
_buffer_width=0;
|
||||
@ -56,7 +56,7 @@ DisplayDriver::DisplayDriver(void)
|
||||
*/
|
||||
DisplayDriver::~DisplayDriver(void)
|
||||
{
|
||||
delete_sem(_lock_sem);
|
||||
delete _locker;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -639,9 +639,10 @@ bool DisplayDriver::IsCursorObscured(bool state)
|
||||
*/
|
||||
bool DisplayDriver::_Lock(bigtime_t timeout)
|
||||
{
|
||||
if(acquire_sem_etc(_lock_sem,1,B_RELATIVE_TIMEOUT,timeout)!=B_NO_ERROR)
|
||||
return false;
|
||||
return true;
|
||||
if(timeout==B_INFINITE_TIMEOUT)
|
||||
return _locker->Lock();
|
||||
|
||||
return (_locker->LockWithTimeout(timeout)==B_OK)?true:false;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -649,7 +650,7 @@ bool DisplayDriver::_Lock(bigtime_t timeout)
|
||||
*/
|
||||
void DisplayDriver::_Unlock(void)
|
||||
{
|
||||
release_sem(_lock_sem);
|
||||
_locker->Unlock();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <View.h>
|
||||
#include <Font.h>
|
||||
#include <Rect.h>
|
||||
#include <Locker.h>
|
||||
#include "RGBColor.h"
|
||||
|
||||
class ServerCursor;
|
||||
@ -157,7 +158,7 @@ protected:
|
||||
ServerCursor *_GetCursor(void);
|
||||
|
||||
private:
|
||||
sem_id _lock_sem;
|
||||
BLocker *_locker;
|
||||
uint8 _buffer_depth;
|
||||
uint16 _buffer_width;
|
||||
uint16 _buffer_height;
|
||||
|
Loading…
Reference in New Issue
Block a user