/* ZReadWriteLock.hpp Author: James Russell Created: 5/17/2012 Purpose: RAII wrapper for SST_ReadWriteLock from libsst-concurrency. License: TODO */ #pragma once #ifndef _ZREADWRITELOCK_HPP #define _ZREADWRITELOCK_HPP #include #include class ZReadWriteLock { private: DISABLE_COPY_AND_ASSIGN(ZReadWriteLock); //The SST_ReadWriteLock SST_ReadWriteLock Lock; public: /* Default Constructor. */ ZReadWriteLock(); /* Destructor. */ ~ZReadWriteLock(); /* public LockForReading Locks this read write lock for reading. Blocks until the lock is obtained. @param ticks - the maximum amount of time to block @return (bool) - true if the lock was obtained, false otherwise */ bool LockForReading(uint32_t ticks) const; /* public LockForWriting Locks this read write lock for writing. Blocks until the lock is obtained. @param ticks - the maximum amount of time to block @return (bool) - true if the lock was obtained, false otherwise */ bool LockForWriting(uint32_t ticks); /* public EndReading Signals that a read operation has completed. @return (void) */ void EndReading() const; /* public EndWriting Signals that a write operation has completed. @return (void) */ void EndWriting(); }; #endif