Library: Foundation
Package: Processes
Header: Poco/FileStreamRWLock.h
Description
A reader writer lock on the file region allows multiple concurrent process-readers or one exclusive process-writer.
Inheritance
Direct Base Classes: FileStreamRWLockImpl
All Base Classes: FileStreamRWLockImpl
Member Summary
Member Functions: readLock, tryReadLock, tryWriteLock, unlock, writeLock
Types Aliases
ScopedLock
using ScopedLock = ScopedFStreamRWLock;
ScopedReadLock
using ScopedReadLock = ScopedFStreamReadRWLock;
ScopedWriteLock
using ScopedWriteLock = ScopedFStreamWriteRWLock;
Constructors
FileStreamRWLock
FileStreamRWLock(
const FileStream & fs,
Poco::UInt64 offset,
Poco::UInt64 size
);
Creates the Reader/Writer lock on the file region. offset - from start of the file size - size of the locker region
Destructor
~FileStreamRWLock
~FileStreamRWLock();
Destroys the Reader/Writer lock on the file region.
Member Functions
readLock
void readLock();
Acquires a read lock. If another process currently holds a write lock, waits until the write lock is released.
tryReadLock
bool tryReadLock();
Tries to acquire a read lock. Immediately returns true if successful, or false if another process currently holds a write lock.
tryWriteLock
bool tryWriteLock();
Tries to acquire a write lock on the file region. Immediately returns true if successful, or false if one or more other processes currently hold locks.
unlock
void unlock();
Releases the read or write lock.
writeLock
void writeLock();
Acquires a write lock on the file region. If one or more other processes currently hold locks, waits until all locks are released.