OpenBarnyard
 
Loading...
Searching...
No Matches
TMutex Class Reference

#include <TMutex_Win.h>

Public Types

enum  FLAG { FLAG_NONE = 0 , FLAG_NO_WAIT = BITFLAG( 0 ) }
 

Public Member Functions

 TMutex ()
 
 ~TMutex ()
 
TBOOL Create ()
 
TBOOL Destroy ()
 
TBOOL Lock (FLAG a_eFlags=FLAG_NONE)
 
TBOOL Unlock ()
 
TMutexoperator= (const TMutex &mutex)
 
TMutexoperator= (void *handle)
 

Detailed Description

Definition at line 5 of file TMutex_Win.h.

Member Enumeration Documentation

◆ FLAG

Enumerator
FLAG_NONE 
FLAG_NO_WAIT 

Definition at line 8 of file TMutex_Win.h.

9 {
10 FLAG_NONE = 0,
11 FLAG_NO_WAIT = BITFLAG( 0 ),
12 };
#define BITFLAG(x)
Definition Defines.h:10
@ FLAG_NO_WAIT
Definition TMutex_Win.h:11
@ FLAG_NONE
Definition TMutex_Win.h:10

Constructor & Destructor Documentation

◆ TMutex()

TMutex::TMutex ( )

Definition at line 14 of file TMutex_Win.cpp.

15{
16}

◆ ~TMutex()

TMutex::~TMutex ( )

Definition at line 18 of file TMutex_Win.cpp.

19{
20 Destroy();
21}
TBOOL Destroy()

Member Function Documentation

◆ Create()

TBOOL TMutex::Create ( )

Definition at line 24 of file TMutex_Win.cpp.

25{
26 m_Handle = CreateMutexA( NULL, FALSE, NULL );
27 return TTRUE;
28}
#define TTRUE
Definition Typedefs.h:25

◆ Destroy()

TBOOL TMutex::Destroy ( )

Definition at line 31 of file TMutex_Win.cpp.

32{
33 BOOL result = CloseHandle( m_Handle );
34 m_Handle = NULL;
35
36 return result;
37}

◆ Lock()

TBOOL TMutex::Lock ( FLAG a_eFlags = FLAG_NONE)

Definition at line 58 of file TMutex_Win.cpp.

59{
60 DWORD waitForMs = ( a_eFlags & FLAG_NO_WAIT ) ? 0 : INFINITE;
61 DWORD result = WaitForSingleObject( m_Handle, waitForMs );
62
63 return result == WAIT_OBJECT_0;
64}

◆ operator=() [1/2]

TMutex & TMutex::operator= ( const TMutex & mutex)

Definition at line 39 of file TMutex_Win.cpp.

40{
41 m_Handle = mutex.m_Handle;
42 return *this;
43}

◆ operator=() [2/2]

TMutex & TMutex::operator= ( void * handle)

Definition at line 45 of file TMutex_Win.cpp.

46{
47 m_Handle = handle;
48 return *this;
49}

◆ Unlock()

TBOOL TMutex::Unlock ( )

Definition at line 52 of file TMutex_Win.cpp.

53{
54 return ReleaseMutex( m_Handle );
55}

The documentation for this class was generated from the following files: