Use std::thread instead of pthread.