mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-14 04:05:04 +00:00
chore: Moved threading classes into Threading subdirectory
This commit is contained in:
31
ICD.Common.Utils/Threading/SafeCriticalSection.Standard.cs
Normal file
31
ICD.Common.Utils/Threading/SafeCriticalSection.Standard.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
#if !SIMPLSHARP
|
||||
using System.Threading;
|
||||
|
||||
namespace ICD.Common.Utils
|
||||
{
|
||||
public sealed partial class SafeCriticalSection
|
||||
{
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Block until ownership of the critical section can be obtained.
|
||||
/// </summary>
|
||||
public void Enter()
|
||||
{
|
||||
Monitor.Enter(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Release ownership of the critical section.
|
||||
/// </summary>
|
||||
public void Leave()
|
||||
{
|
||||
if (Monitor.IsEntered(this))
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user