public static TResult ExecuteWithWriteLock <TResult>(this ReaderWriterLockSlim rwlock, Func <TResult> func) { TResult result = default(TResult); rwlock.ExecuteWithWriteLock(delegate { result = func(); }); return(result); }
public void Dispose() { if (_disposed) { return; } _disposalLock.ExecuteWithWriteLock(() => { _disposed = true; _writer.Close(); _searcher.Close(); _reader.Close(); _queue.Dispose(); if (_commitTimer != null) { _commitTimer.Cancel(); } }); }
internal static IAdoNetProfiler GetProfiler() { return(_readerWriterLockSlim.ExecuteWithWriteLock(() => { if (!_initialized) { throw new InvalidOperationException("This factory class has not initialized yet."); } return _constructor.Invoke(); })); }