[libc++] Refactor atomic_wait using lambdas (#115746)

Now that we've dropped support for older C++ dialects in the
synchronization library, we can use lambdas to clarify some of the code
used to implement atomic_wait.

GitOrigin-RevId: d681e1030ffd71412294d3fadc7ef673f822b832
3 files changed