using System;
namespace Unosquare.Swan.Abstractions {
///
/// Provides a generalized API for ManualResetEvent and ManualResetEventSlim.
///
///
public interface IWaitEvent : IDisposable {
///
/// Gets a value indicating whether the event is in the completed state.
///
Boolean IsCompleted {
get;
}
///
/// Gets a value indicating whether the Begin method has been called.
/// It returns false after the Complete method is called.
///
Boolean IsInProgress {
get;
}
///
/// Returns true if the underlying handle is not closed and it is still valid.
///
Boolean IsValid {
get;
}
///
/// Gets a value indicating whether this instance is disposed.
///
Boolean 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.
Boolean Wait(TimeSpan timeout);
}
}