ReactOS 0.4.15-dev-7942-gd23573b
ATL::CSemaphore Class Reference

#include <atlsync.h>

Inheritance diagram for ATL::CSemaphore:
Collaboration diagram for ATL::CSemaphore:

Private Member Functions

 CSemaphore ()
 
 CSemaphore (CSemaphore &hSemaphore)
 
 CSemaphore (LONG nInitialCount, LONG nMaxCount)
 
 CSemaphore (LPSECURITY_ATTRIBUTES pSecurity, LONG nInitialCount, LONG nMaxCount, LPCTSTR pszName)
 
 CSemaphore (HANDLE hSemaphore)
 
BOOL Create (LPSECURITY_ATTRIBUTES pSecurity, LONG nInitialCount, LONG nMaxCount, LPCTSTR pszName)
 
BOOL Open (DWORD dwAccess, BOOL bInheritHandle, LPCTSTR pszName)
 
BOOL Release (LONG nReleaseCount=1, LPLONG pnOldCount=NULL)
 

Additional Inherited Members

- Public Member Functions inherited from ATL::CHandle
 CHandle ()
 
 CHandle (_Inout_ CHandle &handle)
 
 CHandle (_In_ HANDLE handle)
 
 ~CHandle ()
 
CHandleoperator= (_Inout_ CHandle &handle)
 
 operator HANDLE () const
 
void Attach (_In_ HANDLE handle)
 
HANDLE Detach ()
 
void Close ()
 
- Public Attributes inherited from ATL::CHandle
HANDLE m_handle
 

Detailed Description

Definition at line 152 of file atlsync.h.

Constructor & Destructor Documentation

◆ CSemaphore() [1/5]

ATL::CSemaphore::CSemaphore ( )
inlineprivate

Definition at line 154 of file atlsync.h.

155 {
156 }

◆ CSemaphore() [2/5]

ATL::CSemaphore::CSemaphore ( CSemaphore hSemaphore)
inlineprivate

Definition at line 158 of file atlsync.h.

158 : CHandle(hSemaphore)
159 {
160 }

◆ CSemaphore() [3/5]

ATL::CSemaphore::CSemaphore ( LONG  nInitialCount,
LONG  nMaxCount 
)
inlineprivate

Definition at line 162 of file atlsync.h.

163 {
164 Create(NULL, nInitialCount, nMaxCount, NULL);
165 }
@ Create
Definition: registry.c:563
#define NULL
Definition: types.h:112
_In_ int nMaxCount
Definition: winuser.h:4877

◆ CSemaphore() [4/5]

ATL::CSemaphore::CSemaphore ( LPSECURITY_ATTRIBUTES  pSecurity,
LONG  nInitialCount,
LONG  nMaxCount,
LPCTSTR  pszName 
)
inlineprivate

Definition at line 167 of file atlsync.h.

168 {
169 Create(pSecurity, nInitialCount, nMaxCount, pszName);
170 }

◆ CSemaphore() [5/5]

ATL::CSemaphore::CSemaphore ( HANDLE  hSemaphore)
inlineexplicitprivate

Definition at line 172 of file atlsync.h.

172 : CHandle(hSemaphore)
173 {
174 }

Member Function Documentation

◆ Create()

BOOL ATL::CSemaphore::Create ( LPSECURITY_ATTRIBUTES  pSecurity,
LONG  nInitialCount,
LONG  nMaxCount,
LPCTSTR  pszName 
)
inlineprivate

Definition at line 176 of file atlsync.h.

177 {
178 HANDLE hSemaphore = ::CreateSemaphore(pSecurity, nInitialCount, nMaxCount, pszName);
179 ATLASSERT(hSemaphore != NULL);
180 Attach(hSemaphore);
181 return hSemaphore != NULL;
182 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
void Attach(_In_ HANDLE handle)
Definition: atlbase.h:350
#define CreateSemaphore
Definition: winbase.h:3760

◆ Open()

BOOL ATL::CSemaphore::Open ( DWORD  dwAccess,
BOOL  bInheritHandle,
LPCTSTR  pszName 
)
inlineprivate

Definition at line 184 of file atlsync.h.

185 {
186 HANDLE hSemaphore = ::OpenSemaphore(dwAccess, bInheritHandle, pszName);
187 ATLASSERT(hSemaphore != NULL);
188 Attach(hSemaphore);
189 return hSemaphore != NULL;
190 }
static BOOL bInheritHandle
Definition: pipe.c:82
#define OpenSemaphore
Definition: winbase.h:3889

◆ Release()

BOOL ATL::CSemaphore::Release ( LONG  nReleaseCount = 1,
LPLONG  pnOldCount = NULL 
)
inlineprivate

Definition at line 192 of file atlsync.h.

193 {
194 ATLASSERT(*this);
195 return ::ReleaseSemaphore(*this, nReleaseCount, pnOldCount);
196 }

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