namespace AyCode.Utils.Wrappers
{
    public class ReleaseWrapperSemaphore : IDisposable
    {
        private readonly SemaphoreSlim _semaphore;
        private bool _isDisposed;

        public ReleaseWrapperSemaphore(SemaphoreSlim semaphore) => _semaphore = semaphore;

        public void Dispose()
        {
            if (_isDisposed)
                return;

            _semaphore.Release();
            _isDisposed = true;
        }
    }
}