in Include/rwlock.h [113:132]
void ReleaseRWLock()
{
LONG Count = InterlockedDecrement( &m_rwLock.LockCount );
if ( 0 <= Count )
{
// releasing a read lock
if (( m_rwLock.fWriterWaiting ) && ( 0 == Count ))
{
SetEvent( m_rwLock.ReadersDoneEvent );
}
}
else
{
// Releasing a write lock
m_rwLock.LockCount = 0;
m_rwLock.fWriterWaiting = FALSE;
LeaveCriticalSection(&m_rwLock.critsec);
}
}