1 /* 2 * Copyright 2016-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 package kotlinx.coroutines 6 7 import kotlinx.coroutines.internal.Segment 8 import kotlinx.coroutines.selects.* 9 10 /** 11 * All waiters (such as [CancellableContinuationImpl] and [SelectInstance]) in synchronization and 12 * communication primitives, should implement this interface to make the code faster and easier to read. 13 */ 14 internal interface Waiter { 15 /** 16 * When this waiter is cancelled, [Segment.onCancellation] with 17 * the specified [segment] and [index] should be called. 18 * This function installs the corresponding cancellation handler. 19 */ invokeOnCancellationnull20 fun invokeOnCancellation(segment: Segment<*>, index: Int) 21 } 22