/// <summary> /// Waits for one cycle to be completed. /// </summary> public void WaitOne() { if (IsDisposing) { return; } IsCycleDone.Wait(); }
/// <summary> /// Implementation using the ThreadPool with a wait event. /// </summary> private void DelayThreadPool() { lock (SyncRoot) { if (DelayEvent == null) { DelayEvent = WaitEventFactory.Create(isCompleted: true, useSlim: true); } } DelayEvent.Begin(); ThreadPool.QueueUserWorkItem(s => { DelaySleep(); DelayEvent.Complete(); }); DelayEvent.Wait(); }
private void DelayThreadPool() { if (_delayEvent == null) { _delayEvent = WaitEventFactory.Create(isCompleted: true, useSlim: true); } _delayEvent.Begin(); ThreadPool.QueueUserWorkItem((s) => { DelaySleep(); _delayEvent.Complete(); }); _delayEvent.Wait(); }
/// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> /// <param name="alsoManaged"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> private void Dispose(bool alsoManaged) { if (IsDisposed) { return; } if (alsoManaged) { IsCancellationPending.Value = true; // Causes the playback loop to exit DriverCallbackEvent.Set(); // causes the WaitOne to exit PlaybackFinished.Wait(); // waits for the playback loop to finish DriverCallbackEvent.Dispose(); PlaybackFinished.Dispose(); } IsDisposed = true; }
/// <inheritdoc /> public void WaitForReadyState() => WaitForReadyEvent?.Wait();
/// <inheritdoc /> public void OnStarting() => WaitForReadyEvent?.Wait();