diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index 8827713d933..fce584069dc 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -1,5 +1,5 @@ -#[doc = "An atomically reference counted wrapper that can be used -hare immutable data between tasks."] +#[doc = "An atomically reference counted wrapper that can be used to +share immutable data between tasks."] export arc, get, clone; @@ -34,6 +34,7 @@ resource arc_destruct(data: *arc_data) { type arc = arc_destruct; +#[doc="Create an atomically reference counted wrapper."] fn arc(-data: T) -> arc { let data = ~{mut count: 1, data: data}; unsafe { @@ -43,12 +44,19 @@ fn arc(-data: T) -> arc { } } +#[doc="Access the underlying data in an atomically reference counted + wrapper."] fn get(rc: &a.arc) -> &a.T { unsafe { &(***rc).data } } +#[doc="Duplicate an atomically reference counted wrapper. + +The resulting two `arc` objects will point to the same underlying data +object. However, one of the `arc` objects can be sent to another task, +allowing them to share the underlying data."] fn clone(rc: &arc) -> arc { let data = **rc; unsafe {