yielding
Computes toReturn after the data exchange operation is complete.
Example
sharing(0) { // Sent to neighbors: kotlin.Int
it.max(Int.MIN_VALUE).yielding { it.toString() }
}
result // result: kotlin.StringContent copied to clipboard
val result = sharing(0) {
val max = it.max(Int.MIN_VALUE)
max.yielding { max.toString().takeIf { max 1 } }
}
result // result: kotlin.String?Content copied to clipboard
Calling yielding in the body effectively performs the information exchange with neighbors, preparing the local Initial value (from the extension receiver) to be sent away, but returns the value produced by toReturn.