EventWaitHandle Constructor (Boolean, EventResetMode, String)
Initializes a new instance of the EventWaitHandle class, specifying whether the wait handle is initially signaled if created as a result of this call, whether it resets automatically or manually, and the name of a system synchronization event.
Assemblies: mscorlib (in mscorlib.dll)
System.Threading (in System.Threading.dll)
- Type: System.Boolean
true to set the initial state to signaled if the named event is created as a result of this call; false to set it to nonsignaled.
- Type: System.Threading.EventResetMode
One of the EventResetMode values that determines whether the event resets automatically or manually.
- Type: System.String
The name of a system-wide synchronization event.
A Win32 error occurred.
The named event exists and has access control security, but the user does not have EventWaitHandleRights.FullControl.
The named event cannot be created, perhaps because a wait handle of a different type has the same name.
name is longer than 260 characters.
If name is null or an empty string, a local EventWaitHandle is created.
If a system event with the name specified for the name parameter already exists, the initialState parameter is ignored.
When using this constructor for named system events, specify false for initialState. This constructor provides no way to determine whether a named system event was created, so you cannot make any assumptions about the state of the named event. To determine whether a named event was created, use the EventWaitHandle(Boolean, EventResetMode, String, Boolean) constructor or the EventWaitHandle(Boolean, EventResetMode, String, Boolean, EventWaitHandleSecurity) constructor.
If the initial state of the event is nonsignaled, threads that wait on the event will block. If the initial state is signaled, and the ManualReset flag is specified for mode, threads that wait on the event will not block. If the initial state is signaled, and mode is AutoReset, the first thread that waits on the event will be released immediately, after which the event will reset, and subsequent threads will block.
Requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.