@@ -183,11 +183,10 @@ struct Node {
183183 write : bool ,
184184 thread : OnceCell < Thread > ,
185185 completed : AtomicBool ,
186- is_reading : AtomicBool ,
187186}
188187
189188impl Node {
190- /// Creates a new queue node.
189+ /// Create a new queue node.
191190 fn new ( write : bool ) -> Node {
192191 Node {
193192 next : AtomicLink :: new ( None ) ,
@@ -196,7 +195,6 @@ impl Node {
196195 write,
197196 thread : OnceCell :: new ( ) ,
198197 completed : AtomicBool :: new ( false ) ,
199- is_reading : AtomicBool :: new ( false ) ,
200198 }
201199 }
202200
@@ -338,17 +336,8 @@ impl RwLock {
338336 let mut node = Node :: new ( write) ;
339337 let mut state = self . state . load ( Relaxed ) ;
340338 let mut count = 0 ;
341- let mut has_slept = false ;
342339 loop {
343- if node. is_reading . load ( Acquire ) {
344- // This node was awaken by a call to `downgrade`, which means we are already in read
345- // mode and we can return.
346- debug_assert ! (
347- has_slept,
348- "Somehow `is_reading` is `true` before the node has gone to sleep"
349- ) ;
350- return ;
351- } else if let Some ( next) = update ( state) {
340+ if let Some ( next) = update ( state) {
352341 // The lock is available, try locking it.
353342 match self . state . compare_exchange_weak ( state, next, Acquire , Relaxed ) {
354343 Ok ( _) => return ,
@@ -418,8 +407,6 @@ impl RwLock {
418407 node. wait ( ) ;
419408 }
420409
421- has_slept = true ;
422-
423410 // The node was removed from the queue, disarm the guard.
424411 mem:: forget ( guard) ;
425412
0 commit comments