Implemented wait_any_swapped.

See #903