Docs: clarifications on LazyThreadSafetyMode
This commit is contained in:
@@ -81,7 +81,7 @@ public fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T> = SynchronizedLaz
|
|||||||
public inline operator fun <T> Lazy<T>.getValue(thisRef: Any?, property: KProperty<*>): T = value
|
public inline operator fun <T> Lazy<T>.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 {
|
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,
|
* 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,
|
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,
|
NONE,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user