@@ -20,22 +20,18 @@ use core::atomics;
20
20
21
21
use mutex:: { StaticMutex , MUTEX_INIT } ;
22
22
23
- /// A type which can be used to run a one-time global initialization. This type
24
- /// is *unsafe* to use because it is built on top of the `Mutex` in this module.
25
- /// It does not know whether the currently running task is in a green or native
26
- /// context, and a blocking mutex should *not* be used under normal
27
- /// circumstances on a green task.
28
- ///
29
- /// Despite its unsafety, it is often useful to have a one-time initialization
30
- /// routine run for FFI bindings or related external functionality. This type
31
- /// can only be statically constructed with the `ONCE_INIT` value.
23
+ /// A synchronization primitive which can be used to run a one-time global
24
+ /// initialization. Useful for one-time initialization for FFI or related
25
+ /// functionality. This type can only be constructed with the `ONCE_INIT`
26
+ /// value.
32
27
///
33
28
/// # Example
34
29
///
35
30
/// ```rust
36
31
/// use sync::one::{Once, ONCE_INIT};
37
32
///
38
33
/// static mut START: Once = ONCE_INIT;
34
+ ///
39
35
/// unsafe {
40
36
/// START.doit(|| {
41
37
/// // run initialization here
@@ -60,7 +56,7 @@ impl Once {
60
56
/// will be executed if this is the first time `doit` has been called, and
61
57
/// otherwise the routine will *not* be invoked.
62
58
///
63
- /// This method will block the calling *os thread* if another initialization
59
+ /// This method will block the calling task if another initialization
64
60
/// routine is currently running.
65
61
///
66
62
/// When this function returns, it is guaranteed that some initialization
0 commit comments