diff --git a/ICD.Common.Utils.Tests/SafeCriticalSectionTest.cs b/ICD.Common.Utils.Tests/SafeCriticalSectionTest.cs index 193d406..a67cc6f 100644 --- a/ICD.Common.Utils.Tests/SafeCriticalSectionTest.cs +++ b/ICD.Common.Utils.Tests/SafeCriticalSectionTest.cs @@ -37,30 +37,5 @@ namespace ICD.Common.Utils.Tests Assert.Inconclusive(); } - - [Test] - public void TryEnterTest() - { - int result = 0; - - SafeCriticalSection section = new SafeCriticalSection(); - section.Enter(); - - // ReSharper disable once NotAccessedVariable - ThreadingUtils.SafeInvoke(() => { result = section.TryEnter() ? 0 : 1; }); - - Assert.IsTrue(ThreadingUtils.Wait(() => result == 1, 1000)); - - section.Leave(); - - // ReSharper disable once RedundantAssignment - ThreadingUtils.SafeInvoke(() => - { - result = section.TryEnter() ? 2 : 0; - section.Leave(); - }); - - Assert.IsTrue(ThreadingUtils.Wait(() => result == 2, 1000)); - } - } + } } diff --git a/ICD.Common.Utils/SafeCriticalSection.SimplSharp.cs b/ICD.Common.Utils/SafeCriticalSection.SimplSharp.cs index dae97c1..443a75b 100644 --- a/ICD.Common.Utils/SafeCriticalSection.SimplSharp.cs +++ b/ICD.Common.Utils/SafeCriticalSection.SimplSharp.cs @@ -90,31 +90,6 @@ namespace ICD.Common.Utils } } - /// - /// Attempt to enter the critical section without blocking. - /// - /// - /// True, calling thread has ownership of the critical section; otherwise, false. - /// - public bool TryEnter() - { - if (m_CriticalSection == null) - return false; - - try - { -#if DEBUG - return m_CriticalSection.WaitForMutex(0); -#else - return m_CriticalSection.TryEnter(); -#endif - } - catch (ObjectDisposedException) - { - return false; - } - } - #endregion } } diff --git a/ICD.Common.Utils/SafeCriticalSection.Standard.cs b/ICD.Common.Utils/SafeCriticalSection.Standard.cs index 7b460a6..8b8c56c 100644 --- a/ICD.Common.Utils/SafeCriticalSection.Standard.cs +++ b/ICD.Common.Utils/SafeCriticalSection.Standard.cs @@ -24,17 +24,6 @@ namespace ICD.Common.Utils 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 } }