Created
April 28, 2017 11:51
-
-
Save izmajlowiczl/566e493d5179cedd1601cc073a55dd9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Specifies how a [Lazy] instance synchronizes access among multiple threads. | |
*/ | |
public enum class LazyThreadSafetyMode { | |
/** | |
* Locks are used to ensure that only a single thread can initialize the [Lazy] instance. | |
*/ | |
SYNCHRONIZED, | |
/** | |
* 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. | |
*/ | |
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. | |
* | |
* 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. | |
*/ | |
NONE, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment