Program with std::thread handling logic function