We have an application which utilizes udt4 library as part of network stack to transfer files in p2p mode. When running our application on Windows, somehow SetThreadAffinityMask in common.cpp returned incorrect value, which caues our application crashed.
We finally solved the issue (perhaps it was just a workaround solution) by commenting some lines as followings. Hope this might help those who have also bumped into the same issue. Here you are.
uint64_tCTimer::getTime(){//For Cygwin and other systems without microsecond level resolution, uncomment the following three lines//uint64_t x;//rdtsc(x);//return x / s_ullCPUFrequency;//Specific fix may be necessary if rdtsc is not available either.#ifndef WIN32timevalt;gettimeofday(&t,0);returnt.tv_sec*1000000ULL+t.tv_usec;#elseLARGE_INTEGERccf;//HANDLE hCurThread = ::GetCurrentThread(); //DWORD_PTR dwOldMask = ::SetThreadAffinityMask(hCurThread, 1);if(QueryPerformanceFrequency(&ccf)){LARGE_INTEGERcc;if(QueryPerformanceCounter(&cc)){//SetThreadAffinityMask(hCurThread, dwOldMask); return(cc.QuadPart*1000000ULL/ccf.QuadPart);}}//SetThreadAffinityMask(hCurThread, dwOldMask); returnGetTickCount()*1000ULL;#endif}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Greetings,
We have an application which utilizes udt4 library as part of network stack to transfer files in p2p mode. When running our application on Windows, somehow SetThreadAffinityMask in common.cpp returned incorrect value, which caues our application crashed.
We finally solved the issue (perhaps it was just a workaround solution) by commenting some lines as followings. Hope this might help those who have also bumped into the same issue. Here you are.