using System;
namespace Ryujinx.Common.PreciseSleep
{
///
/// An event which works similarly to an AutoResetEvent, but is backed by a
/// more precise timer that allows waits of less than a millisecond.
///
public interface IPreciseSleepEvent : IDisposable
{
///
/// Adjust a timepoint to better fit the host clock.
/// When no adjustment is made, the input timepoint will be returned.
///
/// Timepoint to adjust
/// Requested timeout in nanoseconds
/// Adjusted timepoint
long AdjustTimePoint(long timePoint, long timeoutNs);
///
/// Sleep until a timepoint, or a signal is received.
/// Given no signal, may wake considerably before, or slightly after the timeout.
///
/// Timepoint to sleep until
/// True if signalled or waited, false if a wait could not be performed
bool SleepUntil(long timePoint);
///
/// Sleep until a signal is received.
///
void Sleep();
///
/// Signal the event, waking any sleeping thread or the next attempted sleep.
///
void Signal();
}
}