uLib  User mode C/C++ extended API library for Win32 programmers.
TSemaphore Class Reference

#include <uLib/SyncObj.h>

Inheritance diagram for TSemaphore:
TSyncObj

Detailed Description

TSemaphore encapsulates an IPC Semaphore object.

Definition at line 150 of file SyncObj.h.

Public Functions

 TSemaphore (LPSECURITY_ATTRIBUTES SecAttr, LONG Count, LONG MaxCount, CSTR Name=NULL)
 
 TSemaphore (DWORD Access, bool Inherit, CSTR Name)
 
 ~TSemaphore ()
 
bool Release (LONG Count, OPTOUT LPLONG OldCount=NULL)
 
LONG ReleaseAll ()
 
LONG Lock ()
 
- Public Functions inherited from TSyncObj
 TSyncObj ()
 
 TSyncObj (const HANDLE &Src)
 
 ~TSyncObj ()
 
bool Close ()
 
bool Wait (DWORD msWait)
 
bool WaitEx (DWORD msWait, bool Alertable)
 
bool SignalAndWait (HANDLE hWaitFor, DWORD msWait, bool Alertable)
 
HANDLE RegisterWait (WAITORTIMERCALLBACK Callback, PVOID Context, DWORD msWait, DWORD Flags)
 
bool UnregisterWait (HANDLE hWait)
 
 operator HANDLE ()
 
HANDLE GetHandle ()
 
bool Initialized ()
 
HANDLE Duplicate (HANDLE TargetProc, bool Inherit, ACCESS_MASK Access=0, DWORD Opt=DUPLICATE_SAME_ACCESS)
 

Additional Inherited Members

- Protected Attributes inherited from TSyncObj
HANDLE _hSync
 

Constructor & Destructor Documentation

◆ TSemaphore() [1/2]

TSemaphore::TSemaphore ( LPSECURITY_ATTRIBUTES  SecAttr,
LONG  Count,
LONG  MaxCount,
CSTR  Name = NULL 
)

CreateSemaphore(..)

Definition at line 277 of file SyncObj.cpp.

◆ TSemaphore() [2/2]

TSemaphore::TSemaphore ( DWORD  Access,
bool  Inherit,
CSTR  Name 
)

OpenSemaphore(..)

Definition at line 283 of file SyncObj.cpp.

◆ ~TSemaphore()

TSemaphore::~TSemaphore ( )

Definition at line 289 of file SyncObj.cpp.

Member Function Documentation

◆ Release()

bool TSemaphore::Release ( LONG  Count,
OPTOUT LPLONG  OldCount = NULL 
)

ReleaseSemaphore(..)

Definition at line 294 of file SyncObj.cpp.

◆ ReleaseAll()

LONG TSemaphore::ReleaseAll ( )

Set semaphore to it's max count.
Return released count.

Definition at line 300 of file SyncObj.cpp.

◆ Lock()

LONG TSemaphore::Lock ( )

Set to unsignaled.
Return count consumed (for later Release()).

Definition at line 312 of file SyncObj.cpp.


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