File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ public class LruItem<K, V>
13
13
private volatile bool wasAccessed ;
14
14
private volatile bool wasRemoved ;
15
15
16
+ // only used when V is a non-atomic value type to prevent torn reads
16
17
private int sequence ;
17
18
18
19
/// <summary>
@@ -63,7 +64,7 @@ internal V SeqLockRead()
63
64
64
65
if ( ( start & 1 ) == 1 )
65
66
{
66
- // A write is in progress. Back off and keep spinning .
67
+ // A write is in progress, spin .
67
68
spin . SpinOnce ( ) ;
68
69
continue ;
69
70
}
@@ -78,7 +79,7 @@ internal V SeqLockRead()
78
79
}
79
80
}
80
81
81
- // Note: item should be locked while invoking this method. Multiple writer threads are not supported.
82
+ // Note: LruItem should be locked while invoking this method. Multiple writer threads are not supported.
82
83
internal void SeqLockWrite ( V value )
83
84
{
84
85
Interlocked . Increment ( ref sequence ) ;
You can’t perform that action at this time.
0 commit comments