Mutex.cpp
author StephaneLenclud
Mon, 28 Apr 2014 20:02:08 +0200
changeset 5 d16669f69f0d
permissions -rw-r--r--
IdwTest:Adding support for sending text to VFD.
     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 //------------------------------------------------------------------------------