Skip to content

Commit 348278a

Browse files
committed
Stabilize Once::is_completed
1 parent 8498c5f commit 348278a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/libstd/sync/once.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,14 @@ impl Once {
331331
/// * `call_once` was called, but has not yet completed,
332332
/// * the `Once` instance is poisoned
333333
///
334-
/// It is also possible that immediately after `is_completed`
335-
/// returns false, some other thread finishes executing
336-
/// `call_once`.
334+
/// This function returning `false` does not mean that `Once` has not been
335+
/// executed. For example, it may have been executed in the time between
336+
/// when `is_completed` starts executing and when it returns, in which case
337+
/// the `false` return value would be stale (but still permissible).
337338
///
338339
/// # Examples
339340
///
340341
/// ```
341-
/// #![feature(once_is_completed)]
342342
/// use std::sync::Once;
343343
///
344344
/// static INIT: Once = Once::new();
@@ -351,7 +351,6 @@ impl Once {
351351
/// ```
352352
///
353353
/// ```
354-
/// #![feature(once_is_completed)]
355354
/// use std::sync::Once;
356355
/// use std::thread;
357356
///
@@ -364,7 +363,7 @@ impl Once {
364363
/// assert!(handle.join().is_err());
365364
/// assert_eq!(INIT.is_completed(), false);
366365
/// ```
367-
#[unstable(feature = "once_is_completed", issue = "54890")]
366+
#[stable(feature = "once_is_completed", since = "1.44.0")]
368367
#[inline]
369368
pub fn is_completed(&self) -> bool {
370369
// An `Acquire` load is enough because that makes all the initialization

0 commit comments

Comments
 (0)