Aar*_*ron 1 c++ windows performance visual-studio-2008
线程在循环中无限期等待,直到标志状态改变,然后调用函数.
伪代码图:
while (true)
{
while (!flag)
{
sleep(1);
}
clean_upfunction();
}
Run Code Online (Sandbox Code Playgroud)
目前:
没有:
题:
Nic*_*ick 10
对于Windows(您已将其标记为),您需要查看WaitForSingleObject.使用Windows事件(使用CreateEvent),然后等待它; 另一个线程应该调用SetEvent.所有本机Windows,没有MFC或任何其他要求.