Fix some doc and comment typos
Do not rely on invalid pthread API use in thread test

Calling mutex_lock from one thread and then mutex_unlock from another is
not permitted.  Replace the awkward mutex usage with a mutex and
condition variable.

llvm.org/pr18061