Use C++11 thread instead of pthread.