File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
kotlin-utils/src/commonMain/kotlin/org/modelix/kotlin/utils Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 13
13
*/
14
14
package org.modelix.kotlin.utils
15
15
16
+ /* *
17
+ * A common abstraction over ThreadLocal and CoroutineContext that integrates both worlds.
18
+ * Allows to set a value that can be read from everywhere on the current thread or coroutine.
19
+ * A suspendable function can call non suspendable functions and the value is synchronized between the CoroutineContext
20
+ * and the internal ThreadLocal.
21
+ */
16
22
expect class ContextValue <E > {
17
23
18
24
constructor ()
19
25
constructor (defaultValue: E )
20
26
27
+ /* *
28
+ * @throws NoSuchElementException if no value is set.
29
+ */
21
30
fun getValue (): E
22
31
fun getValueOrNull (): E ?
23
32
fun getAllValues (): List <E >
You can’t perform that action at this time.
0 commit comments