xref: /aosp_15_r20/external/kotlinx.coroutines/kotlinx-coroutines-core/common/src/Waiter.kt (revision 7a7160fed73afa6648ef8aa100d4a336fe921d9a)
1 package kotlinx.coroutines
2 
3 import kotlinx.coroutines.internal.Segment
4 import kotlinx.coroutines.selects.*
5 
6 /**
7  * All waiters (such as [CancellableContinuationImpl] and [SelectInstance]) in synchronization and
8  * communication primitives, should implement this interface to make the code faster and easier to read.
9  */
10 internal interface Waiter {
11     /**
12      * When this waiter is cancelled, [Segment.onCancellation] with
13      * the specified [segment] and [index] should be called.
14      * This function installs the corresponding cancellation handler.
15      */
invokeOnCancellationnull16     fun invokeOnCancellation(segment: Segment<*>, index: Int)
17 }
18