Multithreading C++ data transfer