Skip to content

Commit

Permalink
Improve comments in sync and arc a bit more.
Browse files Browse the repository at this point in the history
  • Loading branch information
bblum committed Jun 13, 2013
1 parent 57cb44d commit 2ef8774
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/libextra/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,12 @@ impl<T:Const + Owned> RWARC<T> {
* # Example
*
* ~~~ {.rust}
* do arc.write_downgrade |write_mode| {
* do (&write_mode).write_cond |state, condvar| {
* do arc.write_downgrade |mut write_token| {
* do write_token.write_cond |state, condvar| {
* ... exclusive access with mutable state ...
* }
* let read_mode = arc.downgrade(write_mode);
* do (&read_mode).read |state| {
* let read_token = arc.downgrade(write_token);
* do read_token.read |state| {
* ... shared access with immutable state ...
* }
* }
Expand Down
8 changes: 5 additions & 3 deletions src/libextra/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,8 @@ impl RWlock {
// solves this because T1 will hold order_lock while waiting on access,
// which will cause T3 to have to wait until T1 finishes its write,
// which can't happen until T2 finishes the downgrade-read entirely.
// The astute reader will also note that making waking writers use the
// order_lock is better for not starving readers.
unsafe {
do task::unkillable {
(&self.order_lock).acquire();
Expand All @@ -622,12 +624,12 @@ impl RWlock {
* # Example
*
* ~~~ {.rust}
* do lock.write_downgrade |write_token| {
* do (&write_token).write_cond |condvar| {
* do lock.write_downgrade |mut write_token| {
* do write_token.write_cond |condvar| {
* ... exclusive access ...
* }
* let read_token = lock.downgrade(write_token);
* do (&read_token).read {
* do read_token.read {
* ... shared access ...
* }
* }
Expand Down

5 comments on commit 2ef8774

@bors
Copy link
Contributor

@bors bors commented on 2ef8774 Jun 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from brson
at bblum@2ef8774

@bors
Copy link
Contributor

@bors bors commented on 2ef8774 Jun 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging bblum/rust/rwlocks = 2ef8774 into auto

@bors
Copy link
Contributor

@bors bors commented on 2ef8774 Jun 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bblum/rust/rwlocks = 2ef8774 merged ok, testing candidate = 6df66c1

@bors
Copy link
Contributor

@bors bors commented on 2ef8774 Jun 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 2ef8774 Jun 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 6df66c1

Please sign in to comment.