-
Notifications
You must be signed in to change notification settings - Fork 7
named_mutex named_mutex
Alairion edited this page May 8, 2021
·
4 revisions
nes::named_mutex::named_mutex
(1) explicit named_mutex(const std::string& name);
(2) named_mutex(const named_mutex&) = delete;
(3) named_mutex(named_mutex&&) = delete;
- Create a new, or open an existing, named mutex object.
- Deleted copy-constructor.
- Deleted move-constructor.
Name | Description |
---|---|
name |
The UTF-8 encoded name of the named mutex object. The real name of the named mutex object is named_mutex_root + name
|
name
must not be empty.
- Explicit.
- Deleted.
- Deleted.
- Throws a
std::runtime_error
if the named mutex object can not be created or opened. - Deleted.
- Deleted.
- On Windows, first tries to create a new named mutex using
CreateMutexW
, and if it already exists opens it withOpenMutexW
On Posix systems, allocates a shared memory object (shm_open
+ftruncate
) with the specified name (named_mutex_root + name
), then construct a process-shared and robust (PTHREAD_PROCESS_SHARED
,PTHREAD_MUTEX_ROBUST
) mutex inside the shared memory segment, if not already initialized