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:
@@ -36,7 +36,7 @@
|
|||||||
*/
|
*/
|
||||||
DisplayDriver::DisplayDriver(void)
|
DisplayDriver::DisplayDriver(void)
|
||||||
{
|
{
|
||||||
_lock_sem=create_sem(1,"DisplayDriver Lock");
|
_locker=new BLocker();
|
||||||
|
|
||||||
_buffer_depth=0;
|
_buffer_depth=0;
|
||||||
_buffer_width=0;
|
_buffer_width=0;
|
||||||
@@ -56,7 +56,7 @@ DisplayDriver::DisplayDriver(void)
|
|||||||
*/
|
*/
|
||||||
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)
|
bool DisplayDriver::_Lock(bigtime_t timeout)
|
||||||
{
|
{
|
||||||
if(acquire_sem_etc(_lock_sem,1,B_RELATIVE_TIMEOUT,timeout)!=B_NO_ERROR)
|
if(timeout==B_INFINITE_TIMEOUT)
|
||||||
return false;
|
return _locker->Lock();
|
||||||
return true;
|
|
||||||
|
return (_locker->LockWithTimeout(timeout)==B_OK)?true:false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -649,7 +650,7 @@ bool DisplayDriver::_Lock(bigtime_t timeout)
|
|||||||
*/
|
*/
|
||||||
void DisplayDriver::_Unlock(void)
|
void DisplayDriver::_Unlock(void)
|
||||||
{
|
{
|
||||||
release_sem(_lock_sem);
|
_locker->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <View.h>
|
#include <View.h>
|
||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
|
#include <Locker.h>
|
||||||
#include "RGBColor.h"
|
#include "RGBColor.h"
|
||||||
|
|
||||||
class ServerCursor;
|
class ServerCursor;
|
||||||
@@ -157,7 +158,7 @@ protected:
|
|||||||
ServerCursor *_GetCursor(void);
|
ServerCursor *_GetCursor(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
sem_id _lock_sem;
|
BLocker *_locker;
|
||||||
uint8 _buffer_depth;
|
uint8 _buffer_depth;
|
||||||
uint16 _buffer_width;
|
uint16 _buffer_width;
|
||||||
uint16 _buffer_height;
|
uint16 _buffer_height;
|
||||||
|
|||||||
Reference in New Issue
Block a user