nkiesel
06/05/2017, 7:17 PMwaiFor
just waitFor(predecessors: Tasks) = predecessors.forEach { it.await() }
works just as fine
2 replies
Yes, works as expected. Thanks. I actually changed it to suspend fun Tasks.await() = forEach { it.await() }
.
One problem with this approach is that I need to create tasks in their topological order / partially sorted. Would be nicer if I could hide this (i.e. somehow allow callers to add nodes and edges of the dependency graph in any order). Any ideas? or Is there another coroutine construct that would no rely on the topological order?