File tree 2 files changed +9
-7
lines changed
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> {
380
380
* # Example
381
381
*
382
382
* ~~~ {.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| {
385
385
* ... exclusive access with mutable state ...
386
386
* }
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| {
389
389
* ... shared access with immutable state ...
390
390
* }
391
391
* }
Original file line number Diff line number Diff line change @@ -598,6 +598,8 @@ impl RWlock {
598
598
// solves this because T1 will hold order_lock while waiting on access,
599
599
// which will cause T3 to have to wait until T1 finishes its write,
600
600
// 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.
601
603
unsafe {
602
604
do task:: unkillable {
603
605
( & self . order_lock ) . acquire ( ) ;
@@ -622,12 +624,12 @@ impl RWlock {
622
624
* # Example
623
625
*
624
626
* ~~~ {.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| {
627
629
* ... exclusive access ...
628
630
* }
629
631
* let read_token = lock.downgrade(write_token);
630
- * do (& read_token) .read {
632
+ * do read_token.read {
631
633
* ... shared access ...
632
634
* }
633
635
* }
You can’t perform that action at this time.
0 commit comments