DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
Mutex.h
Go to the documentation of this file.
1
5
6#pragma once
7#include "Common.h"
10#include "System/String.h"
11
12namespace DotNetDupe {
13 namespace System {
14 namespace Threading {
21 class Mutex : public LockWaitHandle {
22 public:
25
28 DOTNETDUPE_API Mutex(bool bInitiallyOwned);
29
34 DOTNETDUPE_API Mutex(const String& sName, bool bInitiallyOwned = false, bool openAlways = true);
35
40 DOTNETDUPE_API Mutex(bool bInitiallyOwned, const String& sName, bool openAlways = true);
41
47 DOTNETDUPE_API Mutex(bool bInitiallyOwned, const String& sName, bool openAlways, bool& bCreatedNew);
48
50 DOTNETDUPE_API ~Mutex() override;
51
54 DOTNETDUPE_API bool WaitOne() override;
55
59 DOTNETDUPE_API bool WaitOne(int millisecondsTimeout) override;
60
64 DOTNETDUPE_API int Release(int releaseCount = 1) override;
65
71
76 DOTNETDUPE_API static bool TryOpenExisting(const String& sName, SmartPointer<Mutex>& pResult);
77
78 struct Impl;
79 private:
80 String _name;
81 void* _hHandle;
82 Impl* _pImpl;
83 };
84 }
85 }
86}
Defines common cross-platform macros, export decorators, and fundamental types.
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition Common.h:20
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
Base abstract classes for synchronization wait handles.
A unified smart pointer that supports both unique and shared ownership semantics.
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition String.h:74
Abstract base class for wait handles that support releasing acquire counts.
Definition WaitHandle.h:35
static SmartPointer< Mutex > OpenExisting(const String &sName)
Opens an existing named system mutex.
Definition Mutex.cpp:103
Mutex()
Initializes a new instance of the Mutex class with default properties.
Definition Mutex.cpp:24
int Release(int releaseCount=1) override
Releases the Mutex once.
Definition Mutex.cpp:162
static bool TryOpenExisting(const String &sName, SmartPointer< Mutex > &pResult)
Opens an existing named system mutex, and returns a value that indicates whether the operation succee...
Definition Mutex.cpp:112
bool WaitOne() override
Blocks the current thread until the current WaitHandle receives a signal.
Definition Mutex.cpp:133