public static ExclusiveMutex TryAcquire() { IMemoryMappedQueue queue = null; try { queue = MemoryMappedQueue.Create(QueueName); return(new ExclusiveMutex(queue)); } catch (Exception) { queue?.Dispose(); return(null); } }
public void Dispose() { _consumer.Dispose(); _queue.Dispose(); _isDisposed = true; }