Skip to content

Commit 1b9c0c0

Browse files
committed
---
yaml --- r: 21237 b: refs/heads/snap-stage3 c: 3b09c3d h: refs/heads/master i: 21235: 928d45f v: v3
1 parent c60ca29 commit 1b9c0c0

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 71ec545614e72b815a3685bb461c7853368b92b0
4+
refs/heads/snap-stage3: 3b09c3deaa9a376d0ae40a783713ece3720ca08f
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/arc.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ fn clone<T: const send>(rc: &arc<T>) -> arc<T> {
9393
arc { x: unsafe { clone_shared_mutable_state(&rc.x) } }
9494
}
9595

96+
/**
97+
* Retrieve the data back out of the ARC. This function blocks until the
98+
* reference given to it is the last existing one, and then unwrap the data
99+
* instead of destroying it.
100+
*
101+
* If multiple tasks call unwrap, all but the first will fail. Do not call
102+
* unwrap from a task that holds another reference to the same ARC; it is
103+
* guaranteed to deadlock.
104+
*/
96105
fn unwrap<T: const send>(+rc: arc<T>) -> T {
97106
let arc { x: x } = rc;
98107
unsafe { unwrap_shared_mutable_state(x) }
@@ -186,6 +195,12 @@ impl<T: send> &mutex_arc<T> {
186195
}
187196
}
188197

198+
/**
199+
* Retrieves the data, blocking until all other references are dropped,
200+
* exactly as arc::unwrap.
201+
*
202+
* Will additionally fail if another task has failed while accessing the arc.
203+
*/
189204
// FIXME(#2585) make this a by-move method on the arc
190205
fn unwrap_mutex_arc<T: send>(+arc: mutex_arc<T>) -> T {
191206
let mutex_arc { x: x } = arc;
@@ -363,6 +378,13 @@ impl<T: const send> &rw_arc<T> {
363378
}
364379
}
365380
381+
/**
382+
* Retrieves the data, blocking until all other references are dropped,
383+
* exactly as arc::unwrap.
384+
*
385+
* Will additionally fail if another task has failed while accessing the arc
386+
* in write mode.
387+
*/
366388
// FIXME(#2585) make this a by-move method on the arc
367389
fn unwrap_rw_arc<T: const send>(+arc: rw_arc<T>) -> T {
368390
let rw_arc { x: x, _ } = arc;

0 commit comments

Comments
 (0)