summary refs log tree commit diff
path: root/src/libsync
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-06-12 21:22:01 +0000
committerbors <bors@rust-lang.org>2014-06-12 21:22:01 +0000
commit021bea15fc3e408d6db7bc7f7d999297e678ca01 (patch)
tree8415f96c77c8a0ad5ac5597c1886b6a9cb1d6685 /src/libsync
parent3a9228b7eaa08bfdd4748a7c7178a18d6d435caa (diff)
parent8472849529a9e5a809822d5f9dfc132d937064b1 (diff)
downloadrust-021bea15fc3e408d6db7bc7f7d999297e678ca01.tar.gz
rust-021bea15fc3e408d6db7bc7f7d999297e678ca01.zip
auto merge of #14813 : cmr/rust/once-docs-unsafe, r=alexcrichton
Diffstat (limited to 'src/libsync')
-rw-r--r--src/libsync/one.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/libsync/one.rs b/src/libsync/one.rs
index 2f6caa1d6ff..5240d303ca4 100644
--- a/src/libsync/one.rs
+++ b/src/libsync/one.rs
@@ -20,15 +20,10 @@ use core::atomics;
 
 use mutex::{StaticMutex, MUTEX_INIT};
 
-/// A type which can be used to run a one-time global initialization. This type
-/// is *unsafe* to use because it is built on top of the `Mutex` in this module.
-/// It does not know whether the currently running task is in a green or native
-/// context, and a blocking mutex should *not* be used under normal
-/// circumstances on a green task.
-///
-/// Despite its unsafety, it is often useful to have a one-time initialization
-/// routine run for FFI bindings or related external functionality. This type
-/// can only be statically constructed with the `ONCE_INIT` value.
+/// A synchronization primitive which can be used to run a one-time global
+/// initialization. Useful for one-time initialization for FFI or related
+/// functionality. This type can only be constructed with the `ONCE_INIT`
+/// value.
 ///
 /// # Example
 ///
@@ -36,6 +31,7 @@ use mutex::{StaticMutex, MUTEX_INIT};
 /// use sync::one::{Once, ONCE_INIT};
 ///
 /// static mut START: Once = ONCE_INIT;
+///
 /// unsafe {
 ///     START.doit(|| {
 ///         // run initialization here
@@ -60,7 +56,7 @@ impl Once {
     /// will be executed if this is the first time `doit` has been called, and
     /// otherwise the routine will *not* be invoked.
     ///
-    /// This method will block the calling *os thread* if another initialization
+    /// This method will block the calling task if another initialization
     /// routine is currently running.
     ///
     /// When this function returns, it is guaranteed that some initialization