我在程序里处理某一个问题``但在处理这问题之前,A必需为TRUE,我定义了一个时钟,当检测到某某时,就将A设为TRUE,这时才执行某程序``请问WaitForSingleObject等等的函数怎样用``我想做的是:有一个函数可以完成这样的功能,当A为TRUE时才继续执行,否则暂停执行(相当于Sleep),有这样的函数吗?

解决方案 »

  1.   

    This constructor creates an instance of a named or unnamed CEvent object. To access or release a CEvent object, create a CMultiLock or CSingleLock object and call its Lock and Unlock methods.To change the state of a CEvent object to signaled—threads do not have to wait—call SetEvent or PulseEvent. To set the state of a CEvent object to nonsignaled—threads must wait—call ResetEvent.CEvent(
    BOOL bInitiallyOwn = FALSE,
    BOOL bManualReset = FALSE,
    LPCTSTR lpszName = NULL,
    LPSECURITY_ATTRIBUTES lpsaAttribute = NULL );