File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
library/std/src/sys/pal/unix/locks Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 9191//!
9292//! Access to the queue is controlled by the `QUEUE_LOCKED` bit, which threads
9393//! try to set both after enqueuing themselves to eagerly add backlinks to the
94- //! queue and after unlocking the lock to wake the next waiter(s). This is done
95- //! atomically at the same time as the enqueuing/unlocking operation. The thread
96- //! releasing the `QUEUE_LOCK` bit will check the state of the lock and wake up
97- //! waiters as appropriate. This guarantees forward-progress even if the unlocking
98- //! thread could not acquire the queue lock.
94+ //! queue, which drastically improves performance, and after unlocking the lock
95+ //! to wake the next waiter(s). This is done atomically at the same time as the
96+ //! enqueuing/unlocking operation. The thread releasing the `QUEUE_LOCK` bit
97+ //! will check the state of the lock and wake up waiters as appropriate. This
98+ //! guarantees forward-progress even if the unlocking thread could not acquire
99+ //! the queue lock.
99100//!
100101//! ## Memory orderings
101102//!
@@ -358,7 +359,7 @@ impl RwLock {
358359 } else {
359360 // Otherwise, the tail of the queue is not known.
360361 node. tail . set ( None ) ;
361- // Try locking the queue to fully link it .
362+ // Try locking the queue to eagerly add backlinks .
362363 next = next. map_addr ( |addr| addr | QUEUE_LOCKED ) ;
363364 }
364365
You can’t perform that action at this time.
0 commit comments