Returns a handle to a new event object.
EVENT CreateEvent (int initial_state);
Required Header |
<process.h> |
Return Value
On an error, errno is set to ENOMEM and NULL is returned, otherwise a new EVENT object is returned.
Parameters
initial_state
The initial signalled state for the new event object, 0 is non-signalled anything else is signalled
Remarks
The CreateEvent function creates the structures required for a new EVENT object and returns a handle to the initialised data. The handle may be copied and used by multiple threads and copied into an array that can be used by the Wait-Multiple function. Use the CloseEvent function to deallocate the data.
The CloseEvent function will release all threads waiting on the EVENT as long as it is not waiting on ALL events in a Wait-Multiple function call. The process will deadlock if you try to close an EVENT object while another thread is waiting on multiple EVENTs, including the one being closed, where the one being closed is not the only EVENT non-signalled in the wait.
See Also _beginthread, _endthread, _syncthread, ResetEvent, SetEvent, EventStatus, WaitForSingleEvent, WaitForMultipleEvents, CloseEvent