AddressSpaceWriteLocker: Added VMAddressSpace* constructor and SetTo()

versions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36029 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-04-03 16:11:47 +00:00
parent 4d291edb32
commit 21ff565f76
2 changed files with 28 additions and 0 deletions

View File

@ -173,6 +173,17 @@ AddressSpaceWriteLocker::AddressSpaceWriteLocker(team_id team)
}
AddressSpaceWriteLocker::AddressSpaceWriteLocker(VMAddressSpace* space,
bool getNewReference)
:
fSpace(NULL),
fLocked(false),
fDegraded(false)
{
SetTo(space, getNewReference);
}
AddressSpaceWriteLocker::AddressSpaceWriteLocker()
:
fSpace(NULL),
@ -210,6 +221,19 @@ AddressSpaceWriteLocker::SetTo(team_id team)
}
void
AddressSpaceWriteLocker::SetTo(VMAddressSpace* space, bool getNewReference)
{
fSpace = space;
if (getNewReference)
fSpace->Get();
fSpace->WriteLock();
fLocked = true;
}
status_t
AddressSpaceWriteLocker::SetFromArea(area_id areaID, VMArea*& area)
{

View File

@ -53,10 +53,14 @@ private:
class AddressSpaceWriteLocker : private AddressSpaceLockerBase {
public:
AddressSpaceWriteLocker(team_id team);
AddressSpaceWriteLocker(VMAddressSpace* space,
bool getNewReference);
AddressSpaceWriteLocker();
~AddressSpaceWriteLocker();
status_t SetTo(team_id team);
void SetTo(VMAddressSpace* space,
bool getNewReference);
status_t SetFromArea(area_id areaID, VMArea*& area);
status_t SetFromArea(team_id team, area_id areaID,
bool allowKernel, VMArea*& area);