public override CoreAudioDevice GetDevice(Guid id, DeviceState state) { var acquiredLock = _lock.AcquireReadLockNonReEntrant(); try { return(_deviceCache.FirstOrDefault(x => x.Id == id && state.HasFlag(x.State))); } finally { if (acquiredLock) { _lock.ExitReadLock(); } } }
public IEnumerable <IAudioSession> All() { var acquiredLock = _lock.AcquireReadLockNonReEntrant(); try { return(_sessionCache.ToList()); } finally { if (acquiredLock) { _lock.ExitReadLock(); } } }