stabilize once_wait
This commit is contained in:
parent
7f36543a48
commit
6fa6168e71
2 changed files with 3 additions and 7 deletions
|
@ -174,8 +174,6 @@ impl<T> OnceLock<T> {
|
||||||
///
|
///
|
||||||
/// Waiting for a computation on another thread to finish:
|
/// Waiting for a computation on another thread to finish:
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// #![feature(once_wait)]
|
|
||||||
///
|
|
||||||
/// use std::thread;
|
/// use std::thread;
|
||||||
/// use std::sync::OnceLock;
|
/// use std::sync::OnceLock;
|
||||||
///
|
///
|
||||||
|
@ -189,7 +187,7 @@ impl<T> OnceLock<T> {
|
||||||
/// })
|
/// })
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "once_wait", issue = "127527")]
|
#[stable(feature = "once_wait", since = "CURRENT_RUSTC_VERSION")]
|
||||||
pub fn wait(&self) -> &T {
|
pub fn wait(&self) -> &T {
|
||||||
self.once.wait_force();
|
self.once.wait_force();
|
||||||
|
|
||||||
|
|
|
@ -269,8 +269,6 @@ impl Once {
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// #![feature(once_wait)]
|
|
||||||
///
|
|
||||||
/// use std::sync::Once;
|
/// use std::sync::Once;
|
||||||
/// use std::thread;
|
/// use std::thread;
|
||||||
///
|
///
|
||||||
|
@ -289,7 +287,7 @@ impl Once {
|
||||||
/// If this [`Once`] has been poisoned because an initialization closure has
|
/// If this [`Once`] has been poisoned because an initialization closure has
|
||||||
/// panicked, this method will also panic. Use [`wait_force`](Self::wait_force)
|
/// panicked, this method will also panic. Use [`wait_force`](Self::wait_force)
|
||||||
/// if this behavior is not desired.
|
/// if this behavior is not desired.
|
||||||
#[unstable(feature = "once_wait", issue = "127527")]
|
#[stable(feature = "once_wait", since = "CURRENT_RUSTC_VERSION")]
|
||||||
pub fn wait(&self) {
|
pub fn wait(&self) {
|
||||||
if !self.inner.is_completed() {
|
if !self.inner.is_completed() {
|
||||||
self.inner.wait(false);
|
self.inner.wait(false);
|
||||||
|
@ -298,7 +296,7 @@ impl Once {
|
||||||
|
|
||||||
/// Blocks the current thread until initialization has completed, ignoring
|
/// Blocks the current thread until initialization has completed, ignoring
|
||||||
/// poisoning.
|
/// poisoning.
|
||||||
#[unstable(feature = "once_wait", issue = "127527")]
|
#[stable(feature = "once_wait", since = "CURRENT_RUSTC_VERSION")]
|
||||||
pub fn wait_force(&self) {
|
pub fn wait_force(&self) {
|
||||||
if !self.inner.is_completed() {
|
if !self.inner.is_completed() {
|
||||||
self.inner.wait(true);
|
self.inner.wait(true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue