systhread_sleep(16ms) vs. WaitForSingleObject(16ms)


    Nov 03 2014 | 9:25 pm
    I ask for your advice regarding Max's thread pool in Windows.
    I create a thread with systhread_create(). I have a Windows event handle that will flag when this thread should terminate. I have a loop in which this thread infinitely enters
    Which technique will Max like better? I have tried both and they seem to both function. Each of the below are inside the infinite loop. Is there a benefit in calling systhread_sleep(16) vs. the 16ms delay being in the WaitForSingleObject() ?
    Option 1 WaitForSingleObject(m_hEventShutdown, 0) if (event fired) break; DoStuff() systhread_sleep(16)
    Option 2 WaitForSingleObject(m_hEventShutdown, 16) if (event fired) break; DoStuff()