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                                                            


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@205900 91177308-0d34-0410-b5e6-96231b3b80d8