40 lines
816 B
C++
40 lines
816 B
C++
#include "mutex.hpp"
|
|
|
|
using cruft::thread::win32::mutex;
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
mutex::~mutex ()
|
|
{
|
|
DeleteCriticalSection (&m_section);
|
|
}
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
void mutex::lock (void)
|
|
{
|
|
EnterCriticalSection (&m_section);
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
void mutex::unlock (void)
|
|
{
|
|
LeaveCriticalSection (&m_section);
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
bool mutex::try_lock (void)
|
|
{
|
|
return TryEnterCriticalSection (&m_section);
|
|
}
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
CRITICAL_SECTION&
|
|
mutex::native_handle (void)
|
|
{
|
|
return m_section;
|
|
}
|