Document wait_needed.

Document the wait_needed function.