CEvent::CEvent
Constructs a named or unnamed CEvent object.
CEvent(
BOOL bInitiallyOwn = FALSE,
BOOL bManualReset = FALSE,
LPCTSTR lpszName = NULL,
LPSECURITY_ATTRIBUTES lpsaAttribute = NULL
);
Parameters
bInitiallyOwn
If TRUE, the thread for the CMultilock or CSingleLock object is enabled. Otherwise, all threads wanting to access the resource must wait.bManualReset
If TRUE, specifies that the event object is a manual event, otherwise the event object is an automatic event.lpszName
Name of the CEvent object. Must be supplied if the object will be used across process boundaries. If the name matches an existing event, the constructor builds a new CEvent object which references the event of that name. If the name matches an existing synchronization object that is not an event, the construction will fail. If NULL, the name will be null.lpsaAttribute
Security attributes for the event object. For a full description of this structure, see SECURITY_ATTRIBUTES in the Windows SDK.
Remarks
To access or release a CEvent object, create a CMultiLock or CSingleLock object and call its Lock and Unlock member functions.
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.
Security Note |
---|
After creating the CEvent object, use GetLastError to ensure that the mutex didn't already exist. If the mutex did exist unexpectedly, it may indicate a rogue process is squatting and may be intending to use the mutex maliciously. In this case, the recommended security-conscious procedure is to close the handle and continue as if there was a failure in creating the object. |
Requirements
Header: afxmt.h