Add waitany and waitall functions to wait multiple tasks at once (#53341)
This adds two functions: `waitany` and `waitall`, as discussed in the
issue #53226. These functions wait for multiple tasks at once. The
`waitany` function blocks until one task finishes. The `waitall`
function blocks until all tasks finish.
Co-authored-by: Shuhei Kadowaki <aviatesk@gmail.com>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>