#if !SIMPLSHARP using System.Threading; namespace ICD.Common.Utils { public sealed partial class SafeCriticalSection { #region Methods /// /// Block until ownership of the critical section can be obtained. /// public void Enter() { Monitor.Enter(this); } /// /// Release ownership of the critical section. /// public void Leave() { if (Monitor.IsEntered(this)) Monitor.Exit(this); } /// /// Attempt to enter the critical section without blocking. /// /// /// True, calling thread has ownership of the critical section; otherwise, false. /// public bool TryEnter() { return Monitor.TryEnter(this); } #endregion } } #endif