Use C++11 <atomic> and <thread>