perf(worker): signal-driven event drain — removes the 25 ms latency floor and idle wakeups
This commit is contained in:
@@ -57,6 +57,23 @@ public interface IWorkerRuntimeSession : IDisposable
|
||||
/// <returns>The drained events and the truncation facts describing what stayed queued.</returns>
|
||||
WorkerEventDrainResult DrainEvents(uint maxEvents, int maxTotalBytes);
|
||||
|
||||
/// <summary>
|
||||
/// Waits until the outbound event queue has something for the caller to look at (an
|
||||
/// enqueued event or a recorded fault), the fallback timeout elapses, or the token is
|
||||
/// cancelled. Lets a drain loop be signal-driven instead of polling.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Declared on the interface because the pipe session only ever sees an
|
||||
/// <see cref="IWorkerRuntimeSession"/>, never the queue behind it; .NET Framework 4.8 has
|
||||
/// no default interface members, so every implementation supplies it. The wait's outcome is
|
||||
/// not surfaced: the caller re-drains and re-checks <see cref="DrainFault"/> after every
|
||||
/// wait, because the signal is coalesced and the timeout is a ceiling, not a poll period.
|
||||
/// </remarks>
|
||||
/// <param name="timeout">Maximum time to wait before the wait completes unsignalled.</param>
|
||||
/// <param name="cancellationToken">Token cancelling the wait.</param>
|
||||
/// <returns>A task that completes when the queue is signalled or the timeout elapses.</returns>
|
||||
Task WaitForEventsAsync(TimeSpan timeout, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Drains a pending fault from the queue, if any.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user