Multithreaded c++ tasks