using System;
using System.Runtime.InteropServices;
namespace System.Threading
{
/// Represents a thread synchronization event.
/// 2
// Token: 0x0200060D RID: 1549
[ComVisible(true)]
public class EventWaitHandle : WaitHandle
{
// Token: 0x06003899 RID: 14489 RVA: 0x000C3FE0 File Offset: 0x000C21E0
private EventWaitHandle(IntPtr handle)
{
this.Handle = handle;
}
/// Initializes a new instance of the class, specifying whether the wait handle is initially signaled, and whether it resets automatically or manually.
/// true to set the initial state to signaled; false to set it to nonsignaled.
/// One of the values that determines whether the event resets automatically or manually.
// Token: 0x0600389A RID: 14490 RVA: 0x000C3FF0 File Offset: 0x000C21F0
public EventWaitHandle(bool initialState, EventResetMode mode)
{
bool flag = this.IsManualReset(mode);
bool flag2;
this.Handle = NativeEventCalls.CreateEvent_internal(flag, initialState, null, out flag2);
}
/// Initializes a new instance of the 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.
/// 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.
/// One of the values that determines whether the event resets automatically or manually.
/// 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 .
/// The named event cannot be created, perhaps because a wait handle of a different type has the same name.
///
/// is longer than 260 characters.
// Token: 0x0600389B RID: 14491 RVA: 0x000C401C File Offset: 0x000C221C
public EventWaitHandle(bool initialState, EventResetMode mode, string name)
{
bool flag = this.IsManualReset(mode);
bool flag2;
this.Handle = NativeEventCalls.CreateEvent_internal(flag, initialState, name, out flag2);
}
/// Initializes a new instance of the 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.
/// 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.
/// One of the values that determines whether the event resets automatically or manually.
/// The name of a system-wide synchronization event.
/// When this method returns, contains true if a local event was created (that is, if 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.
/// A Win32 error occurred.
/// The named event exists and has access control security, but the user does not have .
/// The named event cannot be created, perhaps because a wait handle of a different type has the same name.
///
/// is longer than 260 characters.
// Token: 0x0600389C RID: 14492 RVA: 0x000C4048 File Offset: 0x000C2248
public EventWaitHandle(bool initialState, EventResetMode mode, string name, out bool createdNew)
{
bool flag = this.IsManualReset(mode);
this.Handle = NativeEventCalls.CreateEvent_internal(flag, initialState, name, out createdNew);
}
// Token: 0x0600389D RID: 14493 RVA: 0x000C4074 File Offset: 0x000C2274
private bool IsManualReset(EventResetMode mode)
{
if (mode < EventResetMode.AutoReset || mode > EventResetMode.ManualReset)
{
throw new ArgumentException("mode");
}
return mode == EventResetMode.ManualReset;
}
/// Sets the state of the event to nonsignaled, causing threads to block.
/// true if the operation succeeds; otherwise, false.
/// The method was previously called on this .
/// 2
// Token: 0x0600389E RID: 14494 RVA: 0x000C4094 File Offset: 0x000C2294
public bool Reset()
{
base.CheckDisposed();
return NativeEventCalls.ResetEvent_internal(this.Handle);
}
/// Sets the state of the event to signaled, allowing one or more waiting threads to proceed.
/// true if the operation succeeds; otherwise, false.
/// The method was previously called on this .
/// 2
// Token: 0x0600389F RID: 14495 RVA: 0x000C40A8 File Offset: 0x000C22A8
public bool Set()
{
base.CheckDisposed();
return NativeEventCalls.SetEvent_internal(this.Handle);
}
}
}