aboutsummaryrefslogtreecommitdiff
path: root/ctr-std/src/sync/once.rs
diff options
context:
space:
mode:
authorValentin <[email protected]>2018-06-15 18:57:24 +0200
committerFenrirWolf <[email protected]>2018-06-15 10:57:24 -0600
commitf2a90174bb36b9ad528e863ab34c02ebce002b02 (patch)
tree959e8d67883d3a89e179b3549b1f30d28e51a87c /ctr-std/src/sync/once.rs
parentMerge pull request #68 from linouxis9/master (diff)
downloadarchived-ctru-rs-f2a90174bb36b9ad528e863ab34c02ebce002b02.tar.xz
archived-ctru-rs-f2a90174bb36b9ad528e863ab34c02ebce002b02.zip
Update for latest nightly 2018-06-09 (#70)
* Update for latest nightly 2018-06-09 * We now have a proper horizon os and sys modules in libstd
Diffstat (limited to 'ctr-std/src/sync/once.rs')
-rw-r--r--ctr-std/src/sync/once.rs23
1 files changed, 12 insertions, 11 deletions
diff --git a/ctr-std/src/sync/once.rs b/ctr-std/src/sync/once.rs
index 6fd8b6a..7eb7be2 100644
--- a/ctr-std/src/sync/once.rs
+++ b/ctr-std/src/sync/once.rs
@@ -73,16 +73,17 @@ use thread::{self, Thread};
/// 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.
+/// value or the equivalent [`Once::new`] constructor.
///
/// [`ONCE_INIT`]: constant.ONCE_INIT.html
+/// [`Once::new`]: struct.Once.html#method.new
///
/// # Examples
///
/// ```
-/// use std::sync::{Once, ONCE_INIT};
+/// use std::sync::Once;
///
-/// static START: Once = ONCE_INIT;
+/// static START: Once = Once::new();
///
/// START.call_once(|| {
/// // run initialization here
@@ -180,10 +181,10 @@ impl Once {
/// # Examples
///
/// ```
- /// use std::sync::{Once, ONCE_INIT};
+ /// use std::sync::Once;
///
/// static mut VAL: usize = 0;
- /// static INIT: Once = ONCE_INIT;
+ /// static INIT: Once = Once::new();
///
/// // Accessing a `static mut` is unsafe much of the time, but if we do so
/// // in a synchronized fashion (e.g. write once or read all) then we're
@@ -248,10 +249,10 @@ impl Once {
/// ```
/// #![feature(once_poison)]
///
- /// use std::sync::{Once, ONCE_INIT};
+ /// use std::sync::Once;
/// use std::thread;
///
- /// static INIT: Once = ONCE_INIT;
+ /// static INIT: Once = Once::new();
///
/// // poison the once
/// let handle = thread::spawn(|| {
@@ -431,10 +432,10 @@ impl OnceState {
/// ```
/// #![feature(once_poison)]
///
- /// use std::sync::{Once, ONCE_INIT};
+ /// use std::sync::Once;
/// use std::thread;
///
- /// static INIT: Once = ONCE_INIT;
+ /// static INIT: Once = Once::new();
///
/// // poison the once
/// let handle = thread::spawn(|| {
@@ -452,9 +453,9 @@ impl OnceState {
/// ```
/// #![feature(once_poison)]
///
- /// use std::sync::{Once, ONCE_INIT};
+ /// use std::sync::Once;
///
- /// static INIT: Once = ONCE_INIT;
+ /// static INIT: Once = Once::new();
///
/// INIT.call_once_force(|state| {
/// assert!(!state.poisoned());