| description | Learn more about: Mutex Class | ||||
|---|---|---|---|---|---|
| title | Mutex Class | ||||
| ms.date | 10/03/2018 | ||||
| ms.topic | reference | ||||
| f1_keywords |
|
||||
| helpviewer_keywords |
|
||||
| ms.assetid | 682a0963-721c-46a2-8871-000e9997505b |
Represents a synchronization object that exclusively controls a shared resource.
class Mutex : public HandleT<HandleTraits::MutexTraits>;| Name | Description |
|---|---|
SyncLock |
A synonym for a class that supports synchronous locks. |
| Name | Description |
|---|---|
| Mutex::Mutex | Initializes a new instance of the Mutex class. |
| Name | Description |
|---|---|
| Mutex::Lock | Waits until the current object, or the Mutex object associated with the specified handle, releases the mutex or the specified time-out interval has elapsed. |
| Name | Description |
|---|---|
| Mutex::operator= | Assigns (moves) the specified Mutex object to the current Mutex object. |
Mutex
Header: corewrappers.h
Namespace: Microsoft::WRL::Wrappers
Waits until the current object, or the Mutex object associated with the specified handle, releases the mutex 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
The handle of a Mutex object.
Initializes a new instance of the Mutex class.
explicit Mutex(
HANDLE h
);
Mutex(
_Inout_ Mutex&& h
);h
A handle, or an rvalue-reference to a handle, to a Mutex object.
The first constructor initializes a Mutex object from the specified handle. The second constructor initializes a Mutex object from the specified handle, and then moves ownership of the mutex to the current Mutex object.
Assigns (moves) the specified Mutex object to the current Mutex object.
Mutex& operator=(
_Inout_ Mutex&& h
);h
An rvalue-reference to a Mutex object.
A reference to the current Mutex object.
For more information, see the Move Semantics section of Rvalue Reference Declarator: &&.