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.
Assembly: mscorlib (in mscorlib.dll)
public: [SecurityCriticalAttribute] EventWaitHandle( bool initialState, EventResetMode mode, String^ name )
Parameters
- initialState
-
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.
- mode
-
Type:
System.Threading::EventResetMode
One of the EventResetMode values that determines whether the event resets automatically or manually.
- name
-
Type:
System::String^
The name of a system-wide synchronization event.
| Exception | Condition |
|---|---|
| IOException | A Win32 error occurred. |
| UnauthorizedAccessException | The named event exists and has access control security, but the user does not have EventWaitHandleRights::FullControl. |
| WaitHandleCannotBeOpenedException | The named event cannot be created, perhaps because a wait handle of a different type has the same name. |
| ArgumentException | 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.
Important |
|---|
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.
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
