| description | Learn more about: Semaphore Class | ||||
|---|---|---|---|---|---|
| title | Semaphore Class | ||||
| ms.date | 10/03/2018 | ||||
| ms.topic | reference | ||||
| f1_keywords |
|
||||
| helpviewer_keywords |
|
||||
| ms.assetid | ded53526-17b4-4381-9c60-ea5e77363db6 |
Represents a synchronization object that controls a shared resource that can support a limited number of users.
class Semaphore : public HandleT<HandleTraits::SemaphoreTraits>;| Name | Description |
|---|---|
SyncLock |
A synonym for a class that supports synchronous locks. |
| Name | Description |
|---|---|
| Semaphore::Semaphore | Initializes a new instance of the Semaphore class. |
| 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. |
| Name | Description |
|---|---|
| Semaphore::operator= | Moves the specified handle from a Semaphore object to the current Semaphore object. |
Semaphore
Header: corewrappers.h
Namespace: Microsoft::WRL::Wrappers
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
);milliseconds
The time-out interval, in milliseconds. The default value is INFINITE, which waits indefinitely.
h
A handle to a Semaphore object.
A Details::SyncLockWithStatusT<HandleTraits::SemaphoreTraits>
Moves the specified handle from a Semaphore object to the current Semaphore object.
Semaphore& operator=(
_Inout_ Semaphore&& h
);h
Rvalue-reference to a Semaphore object.
A reference to the current Semaphore object.
Initializes a new instance of the Semaphore class.
explicit Semaphore(
HANDLE h
);
WRL_NOTHROW Semaphore(
_Inout_ Semaphore&& h
);h
A handle or an rvalue-reference to a Semaphore object.