MCPcopy Create free account
hub / github.com/HO-COOH/FastCopy / MutexWrapper

Class MutexWrapper

FastCopy/MutexWrapper.h:3–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#pragma once
2#include <Windows.h>
3class MutexWrapper
4{
5 HANDLE m_handle{ INVALID_HANDLE_VALUE };
6public:
7 /**
8 * @brief Create or opens a mutex
9 */
10 MutexWrapper(wchar_t const* name, bool owning = true) : m_handle{ CreateMutex(nullptr, owning, name) } {}
11
12 /**
13 * @brief Try lock the mutex, returns immediately whether it's successful or not
14 */
15 bool TryLock();
16
17 /**
18 * @brief Release mutex if owned
19 */
20 ~MutexWrapper();
21};
22

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected