ReactOS 0.4.15-dev-8236-g99f0937
CicMutex Class Reference

#include <cicmutex.h>

Collaboration diagram for CicMutex:

Public Member Functions

 CicMutex ()
 
 ~CicMutex ()
 
void Init (LPSECURITY_ATTRIBUTES lpSA, LPCTSTR pszMutexName)
 
void Uninit ()
 
BOOL Enter ()
 
void Leave ()
 

Private Attributes

HANDLE m_hMutex
 
BOOL m_bInit
 

Detailed Description

Definition at line 12 of file cicmutex.h.

Constructor & Destructor Documentation

◆ CicMutex()

CicMutex::CicMutex ( )
inline

Definition at line 18 of file cicmutex.h.

19 {
20 }
BOOL m_bInit
Definition: cicmutex.h:15
HANDLE m_hMutex
Definition: cicmutex.h:14
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117

◆ ~CicMutex()

CicMutex::~CicMutex ( )
inline

Definition at line 21 of file cicmutex.h.

22 {
23 Uninit();
24 }
void Uninit()
Definition: cicmutex.h:31

Member Function Documentation

◆ Enter()

BOOL CicMutex::Enter ( )
inline

Definition at line 41 of file cicmutex.h.

42 {
43 DWORD dwWait = ::WaitForSingleObject(m_hMutex, 5000);
44 return (dwWait == WAIT_OBJECT_0) || (dwWait == WAIT_ABANDONED);
45 }
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define WAIT_ABANDONED
Definition: winbase.h:412
#define WAIT_OBJECT_0
Definition: winbase.h:406

Referenced by CicFileMappingStatic::Enter().

◆ Init()

void CicMutex::Init ( LPSECURITY_ATTRIBUTES  lpSA,
LPCTSTR  pszMutexName 
)
inline

Definition at line 26 of file cicmutex.h.

27 {
28 m_hMutex = ::CreateMutex(lpSA, FALSE, pszMutexName);
29 m_bInit = TRUE;
30 }
#define TRUE
Definition: types.h:120
#define CreateMutex
Definition: winbase.h:3756

◆ Leave()

void CicMutex::Leave ( )
inline

Definition at line 46 of file cicmutex.h.

47 {
49 }
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618

Referenced by CicFileMappingStatic::Leave().

◆ Uninit()

void CicMutex::Uninit ( )
inline

Definition at line 31 of file cicmutex.h.

32 {
33 if (m_hMutex)
34 {
36 m_hMutex = NULL;
37 }
38 m_bInit = FALSE;
39 }
#define CloseHandle
Definition: compat.h:739

Referenced by ProcessDetach(), and ~CicMutex().

Member Data Documentation

◆ m_bInit

BOOL CicMutex::m_bInit
private

Definition at line 15 of file cicmutex.h.

Referenced by Init(), and Uninit().

◆ m_hMutex

HANDLE CicMutex::m_hMutex
private

Definition at line 14 of file cicmutex.h.

Referenced by Enter(), Init(), Leave(), and Uninit().


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