* Moved the AutoLocker class out of the kernel/utils/AutoLock.h header
into its own shared/AutoLocker.h. It can be used by userland code too. * Removed headers/private/shared/ObjectLocker.h and replaced all uses of BObjectLocker by AutoLocker. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20432 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -11,10 +11,10 @@
|
||||
|
||||
#include <AppMisc.h>
|
||||
#include <AppServerLink.h>
|
||||
#include <AutoLocker.h>
|
||||
#include <DraggerPrivate.h>
|
||||
#include <LooperList.h>
|
||||
#include <MenuWindow.h>
|
||||
#include <ObjectLocker.h>
|
||||
#include <PortLink.h>
|
||||
#include <RosterPrivate.h>
|
||||
#include <ServerMemoryAllocator.h>
|
||||
@@ -810,7 +810,7 @@ BApplication::WindowAt(int32 index) const
|
||||
int32
|
||||
BApplication::CountLoopers() const
|
||||
{
|
||||
BObjectLocker<BLooperList> ListLock(gLooperList);
|
||||
AutoLocker<BLooperList> ListLock(gLooperList);
|
||||
if (ListLock.IsLocked())
|
||||
return gLooperList.CountLoopers();
|
||||
|
||||
@@ -823,7 +823,7 @@ BLooper *
|
||||
BApplication::LooperAt(int32 index) const
|
||||
{
|
||||
BLooper *looper = NULL;
|
||||
BObjectLocker<BLooperList> listLock(gLooperList);
|
||||
AutoLocker<BLooperList> listLock(gLooperList);
|
||||
if (listLock.IsLocked())
|
||||
looper = gLooperList.LooperAt(index);
|
||||
|
||||
@@ -848,7 +848,7 @@ BApplication::GetAppInfo(app_info *info) const
|
||||
BResources *
|
||||
BApplication::AppResources()
|
||||
{
|
||||
BObjectLocker<BLocker> lock(sAppResourcesLock);
|
||||
AutoLocker<BLocker> lock(sAppResourcesLock);
|
||||
|
||||
// BApplication caches its resources, so check
|
||||
// if it already happened.
|
||||
@@ -1324,7 +1324,7 @@ BApplication::_WindowQuitLoop(bool quitFilePanels, bool force)
|
||||
{
|
||||
BList looperList;
|
||||
{
|
||||
BObjectLocker<BLooperList> listLock(gLooperList);
|
||||
AutoLocker<BLooperList> listLock(gLooperList);
|
||||
if (listLock.IsLocked()) {
|
||||
gLooperList.GetLooperList(&looperList);
|
||||
|
||||
@@ -1469,7 +1469,7 @@ BApplication::_GetWindowList(BList *list, bool includeMenus) const
|
||||
|
||||
// Windows are BLoopers, so we can just check each BLooper to see if it's
|
||||
// a BWindow (or BMenuWindow)
|
||||
BObjectLocker<BLooperList> listLock(gLooperList);
|
||||
AutoLocker<BLooperList> listLock(gLooperList);
|
||||
if (!listLock.IsLocked())
|
||||
return B_ERROR;
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
/*! BLooper class spawns a thread that runs a message loop. */
|
||||
|
||||
#include <AppMisc.h>
|
||||
#include <AutoLocker.h>
|
||||
#include <DirectMessageTarget.h>
|
||||
#include <LooperList.h>
|
||||
#include <MessagePrivate.h>
|
||||
#include <ObjectLocker.h>
|
||||
#include <TokenSpace.h>
|
||||
|
||||
#include <Autolock.h>
|
||||
@@ -53,7 +53,6 @@ static BLocker sDebugPrintLocker("BLooper debug print");
|
||||
// Globals ---------------------------------------------------------------------
|
||||
using BPrivate::gDefaultTokens;
|
||||
using BPrivate::gLooperList;
|
||||
using BPrivate::BObjectLocker;
|
||||
using BPrivate::BLooperList;
|
||||
|
||||
port_id _get_looper_port_(const BLooper* looper);
|
||||
@@ -150,7 +149,7 @@ BLooper::~BLooper()
|
||||
// Clean up our filters
|
||||
SetCommonFilterList(NULL);
|
||||
|
||||
BObjectLocker<BLooperList> ListLock(gLooperList);
|
||||
AutoLocker<BLooperList> ListLock(gLooperList);
|
||||
RemoveHandler(this);
|
||||
|
||||
// Remove all the "child" handlers
|
||||
@@ -824,7 +823,7 @@ status_t
|
||||
BLooper::_PostMessage(BMessage *msg, BHandler *handler,
|
||||
BHandler *replyTo)
|
||||
{
|
||||
BObjectLocker<BLooperList> listLocker(gLooperList);
|
||||
AutoLocker<BLooperList> listLocker(gLooperList);
|
||||
if (!listLocker.IsLocked())
|
||||
return B_ERROR;
|
||||
|
||||
@@ -867,7 +866,7 @@ BLooper::_Lock(BLooper* looper, port_id port, bigtime_t timeout)
|
||||
sem_id sem;
|
||||
|
||||
{
|
||||
BObjectLocker<BLooperList> ListLock(gLooperList);
|
||||
AutoLocker<BLooperList> ListLock(gLooperList);
|
||||
if (!ListLock.IsLocked())
|
||||
return B_BAD_VALUE;
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
|
||||
#include <AppMisc.h>
|
||||
#include <AutoLocker.h>
|
||||
#include <MessageUtils.h>
|
||||
#include "ObjectLocker.h"
|
||||
#include "TokenSpace.h"
|
||||
|
||||
#include <Application.h>
|
||||
@@ -36,7 +36,6 @@
|
||||
using BPrivate::gDefaultTokens;
|
||||
using BPrivate::gLooperList;
|
||||
using BPrivate::BLooperList;
|
||||
using BPrivate::BObjectLocker;
|
||||
|
||||
enum {
|
||||
NOT_IMPLEMENTED = B_ERROR,
|
||||
@@ -114,7 +113,7 @@ BMessenger::BMessenger(const BHandler* handler, const BLooper* looper,
|
||||
}
|
||||
// set port, token,...
|
||||
if (error == B_OK) {
|
||||
BObjectLocker<BLooperList> locker(gLooperList);
|
||||
AutoLocker<BLooperList> locker(gLooperList);
|
||||
if (locker.IsLocked() && gLooperList.IsLooperValid(looper)) {
|
||||
fPort = looper->fMsgPort;
|
||||
fHandlerToken = (handler
|
||||
|
||||
@@ -6,21 +6,19 @@
|
||||
* Ingo Weinhold, bonefish@users.sf.net
|
||||
*/
|
||||
|
||||
|
||||
#include <DiskDevice.h>
|
||||
#include <DiskDeviceList.h>
|
||||
|
||||
#include <AutoLocker.h>
|
||||
#include <DiskDevice.h>
|
||||
#include <DiskDevicePrivate.h>
|
||||
#include <DiskDeviceRoster.h>
|
||||
#include <Locker.h>
|
||||
#include <Looper.h>
|
||||
#include <ObjectLocker.h>
|
||||
#include <Partition.h>
|
||||
|
||||
#include <new>
|
||||
using namespace std;
|
||||
|
||||
using BPrivate::BObjectLocker;
|
||||
|
||||
// constructor
|
||||
/*! \brief Creates an empty BDiskDeviceList object.
|
||||
*/
|
||||
@@ -48,7 +46,7 @@ BDiskDeviceList::~BDiskDeviceList()
|
||||
void
|
||||
BDiskDeviceList::MessageReceived(BMessage *message)
|
||||
{
|
||||
BObjectLocker<BDiskDeviceList> _(this);
|
||||
AutoLocker<BDiskDeviceList> _(this);
|
||||
switch (message->what) {
|
||||
case B_DEVICE_UPDATE:
|
||||
{
|
||||
@@ -110,7 +108,7 @@ void
|
||||
BDiskDeviceList::SetNextHandler(BHandler *handler)
|
||||
{
|
||||
if (!handler) {
|
||||
BObjectLocker<BDiskDeviceList> _(this);
|
||||
AutoLocker<BDiskDeviceList> _(this);
|
||||
if (fSubscribed)
|
||||
_StopWatching();
|
||||
}
|
||||
@@ -136,7 +134,7 @@ status_t
|
||||
BDiskDeviceList::Fetch()
|
||||
{
|
||||
Unset();
|
||||
BObjectLocker<BDiskDeviceList> _(this);
|
||||
AutoLocker<BDiskDeviceList> _(this);
|
||||
// register for notifications
|
||||
status_t error = B_OK;
|
||||
if (Looper())
|
||||
@@ -172,7 +170,7 @@ BDiskDeviceList::Fetch()
|
||||
void
|
||||
BDiskDeviceList::Unset()
|
||||
{
|
||||
BObjectLocker<BDiskDeviceList> _(this);
|
||||
AutoLocker<BDiskDeviceList> _(this);
|
||||
// unsubscribe from notification services
|
||||
_StopWatching();
|
||||
// empty the list
|
||||
|
||||
Reference in New Issue
Block a user