DotNetDupe
4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Toggle main menu visibility
Loading...
Searching...
No Matches
Semaphore.h
Go to the documentation of this file.
1
5
6
#pragma once
7
#include "
Common.h
"
8
#include "
System/Threading/WaitHandle.h
"
9
#include "
System/SmartPointer.h
"
10
#include "
System/String.h
"
11
12
namespace
DotNetDupe
{
13
namespace
System
{
14
namespace
Threading
{
21
class
Semaphore
:
public
LockWaitHandle
{
22
public
:
26
DOTNETDUPE_API
Semaphore
(
int
initialCount,
int
maximumCount);
27
33
DOTNETDUPE_API
Semaphore
(
const
String
& sName,
int
initialCount = 0,
int
maximumCount = 1,
bool
openAlways =
true
);
34
40
DOTNETDUPE_API
Semaphore
(
int
initialCount,
int
maximumCount,
const
String
& sName,
bool
openAlways =
true
);
41
48
DOTNETDUPE_API
Semaphore
(
int
initialCount,
int
maximumCount,
const
String
& sName,
bool
openAlways,
bool
& bCreatedNew);
49
51
DOTNETDUPE_API
~Semaphore
()
override
;
52
55
DOTNETDUPE_API
bool
WaitOne
()
override
;
56
60
DOTNETDUPE_API
bool
WaitOne
(
int
millisecondsTimeout)
override
;
61
66
DOTNETDUPE_API
int
Release
(
int
releaseCount = 1)
override
;
67
72
DOTNETDUPE_API
static
SmartPointer<Semaphore>
OpenExisting
(
const
String
& sName);
73
78
DOTNETDUPE_API
static
bool
TryOpenExisting
(
const
String
& sName,
SmartPointer<Semaphore>
& pResult);
79
80
struct
Impl;
81
private
:
82
int
_count;
83
int
_maxCount;
84
String
_name;
85
void
* _hHandle;
86
Impl* _pImpl;
87
};
88
}
89
}
90
}
Common.h
Defines common cross-platform macros, export decorators, and fundamental types.
DOTNETDUPE_API
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition
Common.h:20
SmartPointer.h
Provides reference-counted and weak pointer memory management primitives ensuring zero raw ownership.
String.h
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
WaitHandle.h
Base abstract classes for synchronization wait handles.
DotNetDupe::System::SmartPointer
A unified smart pointer that supports both unique and shared ownership semantics.
Definition
SmartPointer.h:72
DotNetDupe::System::String
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition
String.h:74
DotNetDupe::System::Threading::LockWaitHandle
Abstract base class for wait handles that support releasing acquire counts.
Definition
WaitHandle.h:35
DotNetDupe::System::Threading::Semaphore::WaitOne
bool WaitOne() override
Blocks the current thread until the current WaitHandle receives a signal.
Definition
Semaphore.cpp:124
DotNetDupe::System::Threading::Semaphore::TryOpenExisting
static bool TryOpenExisting(const String &sName, SmartPointer< Semaphore > &pResult)
Opens an existing named system semaphore, and returns a value that indicates whether the operation su...
Definition
Semaphore.cpp:103
DotNetDupe::System::Threading::Semaphore::Release
int Release(int releaseCount=1) override
Exits the semaphore and returns the previous count.
Definition
Semaphore.cpp:175
DotNetDupe::System::Threading::Semaphore::OpenExisting
static SmartPointer< Semaphore > OpenExisting(const String &sName)
Opens an existing named system semaphore.
Definition
Semaphore.cpp:94
DotNetDupe::System::Threading::Semaphore::Semaphore
Semaphore(int initialCount, int maximumCount)
Initializes a new instance of the Semaphore class, specifying the initial number of entries and the m...
Definition
Semaphore.cpp:27
DotNetDupe::System::Threading
Definition
AbandonedMutexException.h:11
DotNetDupe::System
Definition
Action.h:11
DotNetDupe
Definition
IServiceCollection.h:7
Include
System
Threading
Semaphore.h
Generated by
1.18.0