Skip to content

Commit 5966863

Browse files
committed
---
yaml --- r: 29945 b: refs/heads/incoming c: 3b09c3d h: refs/heads/master i: 29943: f44bbe8 v: v3
1 parent bf56376 commit 5966863

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
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: 71ec545614e72b815a3685bb461c7853368b92b0
9+
refs/heads/incoming: 3b09c3deaa9a376d0ae40a783713ece3720ca08f
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/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)