Make Volume::Read{Lock,Unlock} const

This commit is contained in:
Ingo Weinhold
2011-11-25 06:17:51 +01:00
parent 991ba9fddf
commit 1ac0daa99f
@@ -36,8 +36,8 @@ public:
Volume(fs_volume* fsVolume); Volume(fs_volume* fsVolume);
~Volume(); ~Volume();
inline bool ReadLock(); inline bool ReadLock() const;
inline void ReadUnlock(); inline void ReadUnlock() const;
inline bool WriteLock(); inline bool WriteLock();
inline void WriteUnlock(); inline void WriteUnlock();
@@ -144,7 +144,7 @@ private:
const char* shineThroughSetting); const char* shineThroughSetting);
status_t _AddPackageLinksDirectory(); status_t _AddPackageLinksDirectory();
private: private:
rw_lock fLock; mutable rw_lock fLock;
fs_volume* fFSVolume; fs_volume* fFSVolume;
Directory* fRootDirectory; Directory* fRootDirectory;
::PackageFSRoot* fPackageFSRoot; ::PackageFSRoot* fPackageFSRoot;
@@ -170,14 +170,14 @@ private:
bool bool
Volume::ReadLock() Volume::ReadLock() const
{ {
return rw_lock_read_lock(&fLock) == B_OK; return rw_lock_read_lock(&fLock) == B_OK;
} }
void void
Volume::ReadUnlock() Volume::ReadUnlock() const
{ {
rw_lock_read_unlock(&fLock); rw_lock_read_unlock(&fLock);
} }
@@ -197,7 +197,8 @@ Volume::WriteUnlock()
} }
typedef AutoLocker<Volume, AutoLockerReadLocking<Volume> > VolumeReadLocker; typedef AutoLocker<const Volume, AutoLockerReadLocking<const Volume> >
VolumeReadLocker;
typedef AutoLocker<Volume, AutoLockerWriteLocking<Volume> > VolumeWriteLocker; typedef AutoLocker<Volume, AutoLockerWriteLocking<Volume> > VolumeWriteLocker;