C++11 refactor: move from <pthread.h> to <mutex> <condition_variable> and <thread>.