Use OS X thread ID function instead of getpid()