File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -380,12 +380,12 @@ impl<T:Const + Owned> RWARC<T> {
380380 * # Example
381381 *
382382 * ~~~ {.rust}
383- * do arc.write_downgrade |write_mode | {
384- * do (&write_mode) .write_cond |state, condvar| {
383+ * do arc.write_downgrade |mut write_token | {
384+ * do write_token .write_cond |state, condvar| {
385385 * ... exclusive access with mutable state ...
386386 * }
387- * let read_mode = arc.downgrade(write_mode );
388- * do (&read_mode) .read |state| {
387+ * let read_token = arc.downgrade(write_token );
388+ * do read_token .read |state| {
389389 * ... shared access with immutable state ...
390390 * }
391391 * }
Original file line number Diff line number Diff line change @@ -598,6 +598,8 @@ impl RWlock {
598598 // solves this because T1 will hold order_lock while waiting on access,
599599 // which will cause T3 to have to wait until T1 finishes its write,
600600 // which can't happen until T2 finishes the downgrade-read entirely.
601+ // The astute reader will also note that making waking writers use the
602+ // order_lock is better for not starving readers.
601603 unsafe {
602604 do task:: unkillable {
603605 ( & self . order_lock ) . acquire ( ) ;
@@ -622,12 +624,12 @@ impl RWlock {
622624 * # Example
623625 *
624626 * ~~~ {.rust}
625- * do lock.write_downgrade |write_token| {
626- * do (& write_token) .write_cond |condvar| {
627+ * do lock.write_downgrade |mut write_token| {
628+ * do write_token.write_cond |condvar| {
627629 * ... exclusive access ...
628630 * }
629631 * let read_token = lock.downgrade(write_token);
630- * do (& read_token) .read {
632+ * do read_token.read {
631633 * ... shared access ...
632634 * }
633635 * }
You can’t perform that action at this time.
0 commit comments