1
// -----------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 // -----------------------------------------------------------------------
5 using System
.Collections
.Generic
;
8 using System
.Threading
;
10 namespace Microsoft
.Internal
12 internal struct ReadLock
: IDisposable
14 private readonly Lock _lock
;
15 private int _isDisposed
;
17 public ReadLock(Lock
@lock)
21 this._lock
.EnterReadLock();
26 if (Interlocked
.CompareExchange(ref this._isDisposed
, 1, 0) == 0)
28 this._lock
.ExitReadLock();