Same example with some result (for single thread dispatcher):
suspend fun awaitTrigger(): T {
var t: T? = null
coroutineScope {
val scope = this
launch { t = awaitAutomaticTrigger(); scope.cancel() }
launch { t = awaitManualTrigger(); scope.cancel() }
}
return t!!
}