From 9de6dd814b0b66d02ca4e4c1b7db76804e8ea764 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Wed, 15 Nov 2017 11:53:31 +0300 Subject: [PATCH] Docs: clarifications on LazyThreadSafetyMode --- libraries/stdlib/src/kotlin/util/Lazy.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/stdlib/src/kotlin/util/Lazy.kt b/libraries/stdlib/src/kotlin/util/Lazy.kt index b199c2cb0c9..ce064baa137 100644 --- a/libraries/stdlib/src/kotlin/util/Lazy.kt +++ b/libraries/stdlib/src/kotlin/util/Lazy.kt @@ -81,7 +81,7 @@ public fun lazy(lock: Any?, initializer: () -> T): Lazy = SynchronizedLaz public inline operator fun Lazy.getValue(thisRef: Any?, property: KProperty<*>): T = value /** - * Specifies how a [Lazy] instance synchronizes access among multiple threads. + * Specifies how a [Lazy] instance synchronizes initialization among multiple threads. */ public enum class LazyThreadSafetyMode { @@ -92,14 +92,14 @@ public enum class LazyThreadSafetyMode { /** * Initializer function can be called several times on concurrent access to uninitialized [Lazy] instance value, - * but only first returned value will be used as the value of [Lazy] instance. + * but only the first returned value will be used as the value of [Lazy] instance. */ PUBLICATION, /** - * No locks are used to synchronize the access to the [Lazy] instance value; if the instance is accessed from multiple threads, its behavior is undefined. + * No locks are used to synchronize an access to the [Lazy] instance value; if the instance is accessed from multiple threads, its behavior is undefined. * - * This mode should be used only when high performance is crucial and the [Lazy] instance is guaranteed never to be initialized from more than one thread. + * This mode should not be used unless the [Lazy] instance is guaranteed never to be initialized from more than one thread. */ NONE, }