|
#pragma once
#include <windows.h>
class RWLockFavorNeither
{
public:
RWLockFavorNeither();
~RWLockFavorNeither();
void acquireLockShared();
void acquireLockExclusive();
void releaseLockShared();
void releaseLockExclusive();
DWORD numberReaderRacesLost() const
{
#if defined(TRACK_READER_RACES)
return numReaderRacesLost_;
#else
return 0;
#endif
}
DWORD numberReaderWakeups() const
{
#if defined(TRACK_READER_RACES)
return numReaderWakeups_;
#else
return 0;
#endif
}
private:
LONG numWritersWaiting_;
LONG numReadersWaiting_;
// HIWORD is writer active flag;
// LOWORD is readers active count;
DWORD activeWriterReaders_;
HANDLE hReadyToRead_;
HANDLE hReadyToWrite_;
CRITICAL_SECTION cs_;
DWORD numReaderRacesLost_;
DWORD numReaderWakeups_;
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.