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