64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using System;
|
|
|
|
namespace Unosquare.Swan.Abstractions {
|
|
/// <summary>
|
|
/// Provides a generalized API for ManualResetEvent and ManualResetEventSlim.
|
|
/// </summary>
|
|
/// <seealso cref="IDisposable" />
|
|
public interface IWaitEvent : IDisposable {
|
|
/// <summary>
|
|
/// Gets a value indicating whether the event is in the completed state.
|
|
/// </summary>
|
|
Boolean IsCompleted {
|
|
get;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets a value indicating whether the Begin method has been called.
|
|
/// It returns false after the Complete method is called.
|
|
/// </summary>
|
|
Boolean IsInProgress {
|
|
get;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns true if the underlying handle is not closed and it is still valid.
|
|
/// </summary>
|
|
Boolean IsValid {
|
|
get;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets a value indicating whether this instance is disposed.
|
|
/// </summary>
|
|
Boolean IsDisposed {
|
|
get;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Enters the state in which waiters need to wait.
|
|
/// All future waiters will block when they call the Wait method.
|
|
/// </summary>
|
|
void Begin();
|
|
|
|
/// <summary>
|
|
/// Leaves the state in which waiters need to wait.
|
|
/// All current waiters will continue.
|
|
/// </summary>
|
|
void Complete();
|
|
|
|
/// <summary>
|
|
/// Waits for the event to be completed.
|
|
/// </summary>
|
|
void Wait();
|
|
|
|
/// <summary>
|
|
/// Waits for the event to be completed.
|
|
/// Returns <c>true</c> when there was no timeout. False if the timeout was reached.
|
|
/// </summary>
|
|
/// <param name="timeout">The maximum amount of time to wait for.</param>
|
|
/// <returns><c>true</c> when there was no timeout. <c>false</c> if the timeout was reached.</returns>
|
|
Boolean Wait(TimeSpan timeout);
|
|
}
|
|
}
|