windows - C++ Threading CPU usage issue on older PC -
i need expert's advice , opinion on thread usage. have simple "plugin" dll has 2-3 threads, each of them started _beginthreadex().
a thread looks this:
unsigned __stdcall thread(void* parguments) { while ( true ) { // sleep(3000); } _endthreadex( 0 ); return 0; }
now, thread not have high cpu usage, works expected on new pc's, have discovered on older pc's dual core cpu's example running 2-3 instances threading method take lot of cpu. cannot explain myself why, , don't know do.
i have tried createthread() also, not make change. can please guide me how create thread run same way on pc's ? if i'm doing wrong, please explain me what...
thank you!
_beginthreadex wrapper createthread. , if experience high cpu usage it's problem "do something" code has nothing method used create thread. inspect code profiler , race conditions. note snippet posted broken because loop has no break , therefore method has unreachable code.
Comments
Post a Comment