Here it is
Create a thread in suspended state.
hThrd1 = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) ThreadProc1, (LPVOID) &obj1, CREATE_SUSPENDED, &dwFirstThreadID);
Resume the thread whenever required
ResumeThread(hThrd1);
How do I suspend this running thread. I may resume it after sometime, but I want to suspend it now.
I called
SuspendThread(hThrd1);
Still the for loop in the ThreadProc keeps running. Now how do I avoid it? Also suggest me for any alternatives.