Files
Recyclable.Collections/Recyclable.Collections/Parallel/ManualResetEventSlimmer.cs
T
2023-05-21 15:44:09 +02:00

39 lines
545 B
C#

namespace Recyclable.Collections.Parallel
{
public sealed class ManualResetEventSlimmer
{
internal bool _isSet;
public bool IsSet => _isSet;
internal bool _returned;
public ManualResetEventSlimmer()
{
}
public ManualResetEventSlimmer(bool initialState)
{
_isSet = initialState;
}
public void Set()
{
_isSet = true;
}
public void Reset()
{
_isSet = false;
}
public void Dispose()
{
if (!_returned)
{
_returned = true;
ManualResetEventSlimmerPool.Shared.Return(this);
}
}
}
}