This is simply a cleanup of D18482 (patch taken with permission) while adapting it to match what we have already implemented for libcxx.
Note that I haven't included the external-threading stuff yet, this is only refactoring pthread usage of libcxxabi. A follow-up patch will add the external-threading support.
What's the point of defining _LIBCXXABI_WARNING? It's unused and seems unneeded.