-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Milestone
Description
Feature gate: #![feature(once_wait)]
This is a tracking issue for adding a blocking .wait()
method on Once
and OnceLock
, to allow other threads to synchronize on their completion. This will provide the same interface as once_cell
's OnceCell::wait
.
Public API
impl Once {
/// Block the current thread until the `Once` has been initialized.
fn wait(&self);
/// Block the current thread until the `Once` has been initialized, ignoring poisoning.
fn wait_force(&self);
}
impl OnceLock {
/// Block the current thread until the value is set, then return it.
fn wait(&self) -> &T;
}
Steps / History
- ACP: Add
OnceLock::wait
libs-team#405 - Implementation: std: implement the
once_wait
feature #127567 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- Async API (proposed in the ACP): naming, how it works, interaction with other synchronization primitives since e.g.
Mutex
does not have async methods. This would probably get its own feature gate.
Footnotes
SommerEngineering, PhilipDaniels, Dr-Emann, alexlapa, joseluis and 1 moreSommerEngineering, kjetilkjeka, crlf0710 and teor2345
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.