running C++ function as THREADCONTROL thread