On OS X, GCD worker threads are created without a call to pthread_create. We need to properly register these threads with ThreadCreate and ThreadStart. If we don't do that, the first interceptor called on such a thread will crash.
This patch uses a libpthread API (pthread_introspection_hook_install) to get notifications about new threads and about threads that are about to be destroyed. The worker threads don't have a parent thread, as they are created "spuriously", so a few internal functions need to be modified to accept an invalid (kInvalidTid) parent thread ID.
(This is part of an effort to port TSan to OS X, and it's one the very first steps. Don't expect TSan on OS X to actually work or pass tests at this point.)