java style thread class in c++