| 1 | #pragma once |
| 2 | #include <Windows.h> |
| 3 | class MutexWrapper |
| 4 | { |
| 5 | HANDLE m_handle{ INVALID_HANDLE_VALUE }; |
| 6 | public: |
| 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 |
nothing calls this directly
no outgoing calls
no test coverage detected