Breyta

Deila með


Semaphore Class

Represents a synchronization object that controls a shared resource that can support a limited number of users.

Syntax

class Semaphore : public HandleT<HandleTraits::SemaphoreTraits>;

Members

Public Typedefs

Name Description
SyncLock A synonym for a class that supports synchronous locks.

Public Constructors

Name Description
Semaphore::Semaphore Initializes a new instance of the Semaphore class.

Public Methods

Name Description
Semaphore::Lock Waits until the current object, or the object associated with the specified handle, is in the signaled state or the specified time-out interval has elapsed.

Public Operators

Name Description
Semaphore::operator= Moves the specified handle from a Semaphore object to the current Semaphore object.

Inheritance Hierarchy

Semaphore

Requirements

Header: corewrappers.h

Namespace: Microsoft::WRL::Wrappers

Semaphore::Lock

Waits until the current object, or the Semaphore object associated with the specified handle, is in the signaled state or the specified time-out interval has elapsed.

SyncLock Lock(
   DWORD milliseconds = INFINITE
);

static SyncLock Lock(
   HANDLE h,
   DWORD milliseconds = INFINITE
);

Parameters

milliseconds
The time-out interval, in milliseconds. The default value is INFINITE, which waits indefinitely.

h
A handle to a Semaphore object.

Return Value

A Details::SyncLockWithStatusT<HandleTraits::SemaphoreTraits>

Semaphore::operator=

Moves the specified handle from a Semaphore object to the current Semaphore object.

Semaphore& operator=(
   _Inout_ Semaphore&& h
);

Parameters

h
Rvalue-reference to a Semaphore object.

Return Value

A reference to the current Semaphore object.

Semaphore::Semaphore

Initializes a new instance of the Semaphore class.

explicit Semaphore(
   HANDLE h
);

WRL_NOTHROW Semaphore(
   _Inout_ Semaphore&& h
);

Parameters

h
A handle or an rvalue-reference to a Semaphore object.