ReactOS  0.4.14-dev-115-g4576127
Mutex Class Reference

#include <Mutex.h>

Collaboration diagram for Mutex:

Public Member Functions

 Mutex ()
 
 ~Mutex ()
 
void Lock (void)
 
void Unlock (void)
 
bool IsLocked (void)
 

Protected Attributes

uint32 LockCount
 
HANDLE MutexHandle
 
bool Locked
 

Detailed Description

Definition at line 15 of file Mutex.h.

Constructor & Destructor Documentation

◆ Mutex()

Mutex::Mutex ( )
inline

Definition at line 18 of file Mutex.h.

19  {
20  // NT only code begin ... Win9x disregards this part
21  SECURITY_ATTRIBUTES MutexAttribs;
22 
23  memset (&MutexAttribs, 0, sizeof (SECURITY_ATTRIBUTES));
24 
25  MutexAttribs.bInheritHandle = false;
26  MutexAttribs.nLength = sizeof (SECURITY_ATTRIBUTES);
27  MutexAttribs.lpSecurityDescriptor = NULL;
28  // NT only code end
29 
30  Locked = false;
31  LockCount = 0;
32  MutexHandle = CreateMutex (&MutexAttribs, Locked, NULL);
33 
34  return;
35  }
uint32 LockCount
Definition: Mutex.h:72
smooth NULL
Definition: ftsmooth.c:416
#define CreateMutex
Definition: winbase.h:3580
HANDLE MutexHandle
Definition: Mutex.h:73
LPVOID lpSecurityDescriptor
Definition: compat.h:181
#define memset(x, y, z)
Definition: compat.h:39
bool Locked
Definition: Mutex.h:74
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES

Referenced by AcpiExUnlinkMutex().

◆ ~Mutex()

Mutex::~Mutex ( )
inline

Definition at line 37 of file Mutex.h.

38  {
39  Lock ();
41  }
#define CloseHandle
Definition: compat.h:398
HANDLE MutexHandle
Definition: Mutex.h:73
void Lock(void)
Definition: Mutex.h:43

Member Function Documentation

◆ IsLocked()

bool Mutex::IsLocked ( void  )
inline

Definition at line 66 of file Mutex.h.

67  {
68  return (Locked);
69  }
bool Locked
Definition: Mutex.h:74

◆ Lock()

void Mutex::Lock ( void  )
inline

Definition at line 43 of file Mutex.h.

44  {
45  Locked = true;
47  LockCount += 1;
48  return;
49  }
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
uint32 LockCount
Definition: Mutex.h:72
HANDLE MutexHandle
Definition: Mutex.h:73
#define INFINITE
Definition: serial.h:102
bool Locked
Definition: Mutex.h:74

Referenced by Defragment::Lock(), and ~Mutex().

◆ Unlock()

void Mutex::Unlock ( void  )
inline

Definition at line 52 of file Mutex.h.

53  {
54  LockCount -= 1;
55  if (LockCount <= 0)
56  {
57  LockCount = 0;
58  Locked = false;
59  }
60 
62  return;
63  }
uint32 LockCount
Definition: Mutex.h:72
HANDLE MutexHandle
Definition: Mutex.h:73
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618
bool Locked
Definition: Mutex.h:74

Referenced by Defragment::Unlock().

Member Data Documentation

◆ LockCount

uint32 Mutex::LockCount
protected

Definition at line 72 of file Mutex.h.

Referenced by Lock(), Mutex(), and Unlock().

◆ Locked

bool Mutex::Locked
protected

Definition at line 74 of file Mutex.h.

Referenced by IsLocked(), Lock(), Mutex(), and Unlock().

◆ MutexHandle

HANDLE Mutex::MutexHandle
protected

Definition at line 73 of file Mutex.h.

Referenced by Lock(), Mutex(), Unlock(), and ~Mutex().


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