/// <summary> /// Informs a time source that the time sink interrupted the execution before finishing the granted interval. /// In order to finish the job it is required to call <see cref="RequestTimeInterval"> followed by <see cref="ReportBackAndContinue">. /// </summary> /// <remarks> /// No new time interval will be granted to this and all other time sinks in the time domain until <see cref="ReportBackAndContinue"> is called. /// It is illegal to call this method without first obtaining the interval using <see cref="RequestTimeInterval">. /// </remarks> /// <param name="intervalLeft">Amount of time not used.</param> public void ReportBackAndBreak(TimeInterval timeLeft) { this.Trace($"{timeLeft.Ticks}"); lock (innerLock) { if (DetachRequested) { return; } DebugHelper.Assert(sinkSideInProgress, "Reporting a used time, but it seems that no grant has recently been requested."); sinkSideInProgress = false; intervalToReport = intervalGranted - timeLeft; intervalGranted = timeLeft; isBlocking = true; reportPending = true; Monitor.PulseAll(innerLock); this.Trace(); } ReportedBack?.Invoke(); }
/// <summary> /// Informs a time source that the time interval is used, i.e., no more work can be done without exceeding it, and the sink is ready for the next one. /// </summary> /// <remarks> /// It is possible that some part of granted interval cannot be used in this round. This value must be passed in <paramref name="timeLeft"> parameter. /// It is illegal to call this method without first obtaining the interval using <see cref="RequestTimeInterval">. /// </remarks> /// <param name="timeLeft">Amount of time not used.</param> public void ReportBackAndContinue(TimeInterval timeLeft) { this.Trace($"{timeLeft.Ticks}"); lock (innerLock) { if (DetachRequested) { return; } DebugHelper.Assert(sinkSideInProgress, "Reporting a used time, but it seems that no grant has recently been requested."); sinkSideInProgress = false; DebugHelper.Assert(slaveTimeResiduum == TimeInterval.Empty, "Time residuum should be empty here."); slaveTimeResiduum = timeLeft; intervalToReport = intervalGranted; reportPending = true; Monitor.PulseAll(innerLock); this.Trace(); } ReportedBack?.Invoke(); }