File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 5b72e52e472ca06f42700a322dc2cac4c38e05f1
2
+ refs/heads/master: 30f8555544481e998f52d196c5a0f4d04cbcf334
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
5
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
Original file line number Diff line number Diff line change 1
- #[ doc = "An atomically reference counted wrapper that can be used
2
- hare immutable data between tasks."]
1
+ #[ doc = "An atomically reference counted wrapper that can be used to
2
+ share immutable data between tasks."]
3
3
4
4
export arc, get, clone;
5
5
@@ -34,6 +34,7 @@ resource arc_destruct<T>(data: *arc_data<T>) {
34
34
35
35
type arc < T > = arc_destruct < T > ;
36
36
37
+ #[ doc="Create an atomically reference counted wrapper." ]
37
38
fn arc < T > ( -data : T ) -> arc < T > {
38
39
let data = ~{ mut count: 1 , data: data} ;
39
40
unsafe {
@@ -43,12 +44,19 @@ fn arc<T>(-data: T) -> arc<T> {
43
44
}
44
45
}
45
46
47
+ #[ doc="Access the underlying data in an atomically reference counted
48
+ wrapper." ]
46
49
fn get < T > ( rc : & a. arc < T > ) -> & a . T {
47
50
unsafe {
48
51
& ( * * * rc) . data
49
52
}
50
53
}
51
54
55
+ #[ doc="Duplicate an atomically reference counted wrapper.
56
+
57
+ The resulting two `arc` objects will point to the same underlying data
58
+ object. However, one of the `arc` objects can be sent to another task,
59
+ allowing them to share the underlying data." ]
52
60
fn clone < T > ( rc : & arc < T > ) -> arc < T > {
53
61
let data = * * rc;
54
62
unsafe {
You can’t perform that action at this time.
0 commit comments