Skip to content

Commit fdb6f58

Browse files
std: Doc blocking behavior of LazyLock
1 parent 62d7ed4 commit fdb6f58

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

library/std/src/sync/lazy_lock.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,11 @@ impl<T, F: FnOnce() -> T> LazyLock<T, F> {
134134
}
135135
}
136136

137-
/// Forces the evaluation of this lazy value and
138-
/// returns a reference to result. This is equivalent
139-
/// to the `Deref` impl, but is explicit.
137+
/// Forces the evaluation of this lazy value and returns a reference to
138+
/// result. This is equivalent to the `Deref` impl, but is explicit.
139+
///
140+
/// This method will block the calling thread if another initialization
141+
/// routine is currently running.
140142
///
141143
/// # Examples
142144
///
@@ -204,6 +206,11 @@ impl<T, F> Drop for LazyLock<T, F> {
204206
impl<T, F: FnOnce() -> T> Deref for LazyLock<T, F> {
205207
type Target = T;
206208

209+
/// Dereferences the value.
210+
///
211+
/// This method will block the calling thread if another initialization
212+
/// routine is currently running.
213+
///
207214
#[inline]
208215
fn deref(&self) -> &T {
209216
LazyLock::force(self)

0 commit comments

Comments
 (0)