C++ threading working with MATLAB functions in Win