Wait for whichever task is first

You can use channels or conditions — e.g. define a Condition and have the tasks call notify on it when they are done. Then you can just wait on that condition.

See also this discussion: How to call wait on multiple Tasks? - #4 by Jeff_Emanuel