[analyzer] Fix pthread lock tests so that the API comes from a system header.

...and verify that a global mutex in user code can be used without warnings.

Patch by Aleksei Sidorin!

git-svn-id: http://llvm.org/svn/llvm-project/cfe/trunk@217515 91177308-0d34-0410-b5e6-96231b3b80d8