Skip to content

Commit

Permalink
Implemented CopyableThreadContextElement with a `copyForChildCorout…
Browse files Browse the repository at this point in the history
…ine()`. (Kotlin#3025)


* This is a `ThreadContextElement` that is copy-constructed when a new coroutine
is created and inherits the context.


Co-authored-by: Tyson Henning <yorick@google.com>

Fixes Kotlin#2839
  • Loading branch information
qwwdfsad authored and yorickhenning committed Jan 28, 2022
1 parent 9f04059 commit c08a160
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions kotlinx-coroutines-core/api/kotlinx-coroutines-core.api
Expand Up @@ -140,6 +140,17 @@ public final class kotlinx/coroutines/CompletionHandlerException : java/lang/Run
public fun <init> (Ljava/lang/String;Ljava/lang/Throwable;)V
}

public abstract interface class kotlinx/coroutines/CopyableThreadContextElement : kotlinx/coroutines/ThreadContextElement {
public abstract fun copyForChildCoroutine ()Lkotlinx/coroutines/CopyableThreadContextElement;
}

public final class kotlinx/coroutines/CopyableThreadContextElement$DefaultImpls {
public static fun fold (Lkotlinx/coroutines/CopyableThreadContextElement;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object;
public static fun get (Lkotlinx/coroutines/CopyableThreadContextElement;Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext$Element;
public static fun minusKey (Lkotlinx/coroutines/CopyableThreadContextElement;Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext;
public static fun plus (Lkotlinx/coroutines/CopyableThreadContextElement;Lkotlin/coroutines/CoroutineContext;)Lkotlin/coroutines/CoroutineContext;
}

public abstract interface class kotlinx/coroutines/CopyableThrowable {
public abstract fun createCopy ()Ljava/lang/Throwable;
}
Expand Down

0 comments on commit c08a160

Please sign in to comment.