|
The Pedigree Project
0.1
|
#include <LockedFile.h>
Collaboration diagram for LockedFile:Public Member Functions | |
| LockedFile (File *pFile) | |
| LockedFile (LockedFile &c) | |
| LockedFile & | operator= (const LockedFile &c) |
| bool | lock (bool bBlock=false) |
| void | unlock () |
| File * | getFile () |
| size_t | getLocker () |
Private Member Functions | |
| LockedFile () | |
Private Attributes | |
| File * | m_File |
| bool | m_bLocked |
| size_t | m_LockerPid |
| Mutex | m_Lock |
LockedFile is a wrapper around a standard File with the ability to lock access to it. Locked access is in the form of a Mutex that allows only one thread exclusive access to the file.
Definition at line 32 of file LockedFile.h.
| LockedFile::LockedFile | ( | File * | pFile | ) |
Standard wrapper constructor
Definition at line 28 of file LockedFile.cc.
| LockedFile::LockedFile | ( | LockedFile & | c | ) |
Copy constructor
Definition at line 36 of file LockedFile.cc.
References Semaphore::acquire(), m_bLocked, m_File, m_Lock, and m_LockerPid.
|
private |
Default constructor, not to be used
| File * LockedFile::getFile | ( | ) |
To enforce mandatory locking, use this function to obtain a File to work with. If the file is locked and you don't own the lock, you'll get a NULL File. Otherwise you'll get the wrapped File ready for I/O.
Definition at line 87 of file LockedFile.cc.
References Processor::information(), m_bLocked, m_File, and m_LockerPid.
| size_t LockedFile::getLocker | ( | ) |
Who's locking the file?
Definition at line 101 of file LockedFile.cc.
References m_bLocked, and m_LockerPid.
| bool LockedFile::lock | ( | bool | bBlock = false | ) |
Attempts to obtain the lock (exclusively)
Definition at line 55 of file LockedFile.cc.
References Semaphore::acquire(), Processor::information(), m_bLocked, m_Lock, m_LockerPid, and Semaphore::tryAcquire().
| LockedFile& LockedFile::operator= | ( | const LockedFile & | c | ) |
Operator =
| void LockedFile::unlock | ( | ) |
Releases the lock
Definition at line 76 of file LockedFile.cc.
References m_bLocked, m_Lock, and Semaphore::release().
Referenced by FileDescriptor::~FileDescriptor().
Here is the caller graph for this function:
|
private |
Is this file locked?
Definition at line 70 of file LockedFile.h.
Referenced by getFile(), getLocker(), lock(), LockedFile(), and unlock().
|
private |
Is a range locked? The file that we're wrapping
Definition at line 67 of file LockedFile.h.
Referenced by getFile(), and LockedFile().
|
private |
Our lock
Definition at line 77 of file LockedFile.h.
Referenced by lock(), LockedFile(), and unlock().
|
private |
Locker PID
Definition at line 73 of file LockedFile.h.
Referenced by getFile(), getLocker(), lock(), and LockedFile().
1.8.11