Barotrauma Client Doc
Threading.cs
1 using System.Threading;
2 
4 {
5  internal readonly ref struct ReadLock
6  {
7  private readonly ReaderWriterLockSlim rwl;
8  public ReadLock(ReaderWriterLockSlim rwl)
9  {
10  this.rwl = rwl;
11  rwl.EnterReadLock();
12  }
13 
14  public void Dispose()
15  {
16  rwl.ExitReadLock();
17  }
18  }
19 
20  internal readonly ref struct WriteLock
21  {
22  private readonly ReaderWriterLockSlim rwl;
23  public WriteLock(ReaderWriterLockSlim rwl)
24  {
25  this.rwl = rwl;
26  rwl.EnterWriteLock();
27  }
28 
29  public void Dispose()
30  {
31  rwl.ExitWriteLock();
32  }
33  }
34 }