Export (0) Print
Expand All

EventWaitHandle Constructor (Boolean, EventResetMode, String, Boolean)

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, the name of a system synchronization event, and a Boolean variable whose value after the call indicates whether the named system event was created.

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)

public EventWaitHandle(
	bool initialState,
	EventResetMode mode,
	string name,
	out bool createdNew
)

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.

createdNew
Type: System.Boolean

When this method returns, contains true if a local event was created (that is, if name is null or an empty string) or if the specified named system event was created; false if the specified named system event already existed. This parameter is passed uninitialized.

ExceptionCondition
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 a system event with the name specified for the name parameter already exists, the initialState parameter is ignored. After calling this constructor, use the value in the variable specified for the ref parameter (ByRef parameter in Visual Basic) createdNew to determine whether the named system event already existed or was created.

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.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

  • SecurityCriticalAttribute 

    Requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft