Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 218957f

Browse files
rcabrrcabr
authored andcommitted
Update ReaderWriterLockSlim.cs comments
Minor fixes to comments to correct typos.
1 parent 6a77a53 commit 218957f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/System.Threading/src/System/Threading/ReaderWriterLockSlim.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ public class ReaderWriterLockSlim : IDisposable
5555
//Specifying if locked can be reacquired recursively.
5656
private bool _fIsReentrant;
5757

58-
// Lock specifiation for myLock: This lock protects exactly the local fields associted
59-
// instance of ReaderWriterLockSlim. It does NOT protect the memory associted with the
58+
// Lock specification for myLock: This lock protects exactly the local fields associated with this
59+
// instance of ReaderWriterLockSlim. It does NOT protect the memory associated with
6060
// the events that hang off this lock (eg writeEvent, readEvent upgradeEvent).
6161
private int _myLock;
6262

63-
//The variables controlling spinning behaviior of Mylock(which is a spin-lock)
63+
//The variables controlling spinning behavior of Mylock(which is a spin-lock)
6464

6565
private const int LockSpinCycles = 20;
6666
private const int LockSpinCount = 10;
@@ -105,19 +105,19 @@ public class ReaderWriterLockSlim : IDisposable
105105
//Note:
106106
//The Uint is divided as follows:
107107
//
108-
//Writer-Owned Waiting-Writers Waiting Upgraders Num-REaders
108+
//Writer-Owned Waiting-Writers Waiting Upgraders Num-Readers
109109
// 31 30 29 28.......0
110110
//
111111
//Dividing the uint, allows to vastly simplify logic for checking if a
112-
//reader should go in etc. Setting the writer bit, will automatically
112+
//reader should go in etc. Setting the writer bit will automatically
113113
//make the value of the uint much larger than the max num of readers
114114
//allowed, thus causing the check for max_readers to fail.
115115

116116
private const uint WRITER_HELD = 0x80000000;
117117
private const uint WAITING_WRITERS = 0x40000000;
118118
private const uint WAITING_UPGRADER = 0x20000000;
119119

120-
//The max readers is actually one less then it's theoretical max.
120+
//The max readers is actually one less then its theoretical max.
121121
//This is done in order to prevent reader count overflows. If the reader
122122
//count reaches max, other readers will wait.
123123
private const uint MAX_READER = 0x10000000 - 2;
@@ -301,7 +301,7 @@ private bool TryEnterReadLockCore(TimeoutTracker timeout)
301301
//Check if the reader lock is already acquired. Note, we could
302302
//check the presence of a reader by not allocating rwc (But that
303303
//would lead to two lookups in the common case. It's better to keep
304-
//a count in the struucture).
304+
//a count in the structure).
305305
if (lrwc.readercount > 0)
306306
{
307307
ExitMyLock();
@@ -919,7 +919,7 @@ private bool WaitOnEvent(EventWaitHandle waitEvent, ref uint numWaiters, Timeout
919919
if (_numWriteUpgradeWaiters == 0)
920920
ClearUpgraderWaiting();
921921

922-
if (!waitSuccessful) // We may also be aboutto throw for some reason. Exit myLock.
922+
if (!waitSuccessful) // We may also be about to throw for some reason. Exit myLock.
923923
ExitMyLock();
924924
}
925925
return waitSuccessful;

0 commit comments

Comments
 (0)