namespace AyCode.Utils.Wrappers
{
    public class ReleaseWrapperMutex : IDisposable
    {
        private readonly Mutex _mutex;
        private bool _isDisposed;

        public ReleaseWrapperMutex(Mutex mutex) => _mutex = mutex;

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

            _mutex.ReleaseMutex();
            _isDisposed = true;
        }
    }
}