mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-14 04:58:33 +00:00
Don't throw an exception when attempting to leave an unentered critical section, for consistency with simplsharp
This commit is contained in:
parent
873e02b175
commit
f571807137
2 changed files with 5 additions and 1 deletions
|
|
@ -32,6 +32,9 @@ namespace ICD.Common.Utils.Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void LeaveTest()
|
public void LeaveTest()
|
||||||
{
|
{
|
||||||
|
SafeCriticalSection section = new SafeCriticalSection();
|
||||||
|
Assert.DoesNotThrow(() => section.Leave());
|
||||||
|
|
||||||
Assert.Inconclusive();
|
Assert.Inconclusive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ namespace ICD.Common.Utils
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Leave()
|
public void Leave()
|
||||||
{
|
{
|
||||||
Monitor.Exit(this);
|
if (Monitor.IsEntered(this))
|
||||||
|
Monitor.Exit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue