convert to C++11 mutex/condition_variable