[libc++] Fix some tests that were broken in the single-threaded configuration

We never noticed it because our CI doesn't actually build against a C
library that doesn't have threading functionality, however building
against a truly thread-free platform surfaces these issues.

Differential Revision: https://reviews.llvm.org/D114242

GitOrigin-RevId: e1ce3dabf0c70d30a24f0586ddf2a965d730d30a
13 files changed