use std::thread instead of _beginthreadex.