Mutex.cpp
author sl
Sun, 16 Mar 2014 09:11:39 +0100
changeset 0 523a7dc3469f
permissions -rw-r--r--
First contribution.
     1 //------------------------------------------------------------------------------
     2 #include "Mutex.h"
     3 //------------------------------------------------------------------------------
     4 Mutex::Mutex()
     5 {
     6   m_hMutex = CreateMutex(NULL, FALSE, NULL);
     7 }
     8 //------------------------------------------------------------------------------
     9 Mutex::~Mutex()
    10 {
    11   if (m_hMutex)
    12     CloseHandle(m_hMutex);
    13 }
    14 //------------------------------------------------------------------------------
    15 void Mutex::Request() const
    16 {
    17   WaitForSingleObject(m_hMutex, INFINITE);
    18 }
    19 //------------------------------------------------------------------------------
    20 void Mutex::Release() const
    21 {
    22   ReleaseMutex(m_hMutex);
    23 }
    24 //------------------------------------------------------------------------------