/// <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) { // free managed resources Commands.Close(); if (Container != null) { Container.Dispose(); Container = null; } if (UIPropertyUpdateTimer != null) { UIPropertyUpdateTimer.Stop(); UIPropertyUpdateTimer.IsEnabled = false; UIPropertyUpdateTimer = null; } PacketReadingCycle.Dispose(); FrameDecodingCycle.Dispose(); BlockRenderingCycle.Dispose(); SeekingDone.Dispose(); DelayLock.Dispose(); } IsDisposed = true; }
/// <summary> /// Stops the block rendering worker. /// </summary> private void StopBlockRenderingWorker() { if (HasBlockRenderingWorkerExited == null) { return; } HasBlockRenderingWorkerExited.WaitOne(); BlockRenderingCycle.WaitOne(); BlockRenderingWorker.Dispose(); BlockRenderingWorker = null; HasBlockRenderingWorkerExited.Dispose(); HasBlockRenderingWorkerExited = null; }
/// <summary> /// Releases unmanaged and - optionally - managed resources. /// Please not that this call is non-blocking/asynchronous. /// </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; } // Run the close command immediately if (BeginSynchronousCommand() == false) { return; } // Dispose the wait handle: No more command accepted from this point forward. SynchronousCommandDone.Dispose(); try { var closeCommand = new CloseCommand(Commands); closeCommand.RunSynchronously(); } catch { throw; } finally { IsDisposed = true; } // Dispose the container Container?.Dispose(); Container = null; // Dispose the RTC Clock.Dispose(); // Dispose the Wait Event objects as they are // backed by unmanaged code PacketReadingCycle.Dispose(); FrameDecodingCycle.Dispose(); BlockRenderingCycle.Dispose(); SeekingDone.Dispose(); MediaChangingDone.Dispose(); }
/// <summary> /// Performs a seek operation to the specified position. /// </summary> /// <param name="position">The position.</param> private void Seek(TimeSpan position) { SeekingDone.Wait(); var startTime = DateTime.UtcNow; var resumeClock = Clock.IsRunning; Clock.Pause(); SeekingDone.Reset(); PacketReadingCycle.Wait(); FrameDecodingCycle.Wait(); BlockRenderingCycle.Wait(); // Clear Blocks and frames, reset the render times foreach (var t in Container.Components.MediaTypes) { Frames[t].Clear(); Blocks[t].Clear(); LastRenderTime[t] = TimeSpan.MinValue; } // Populate frame with after-seek operation var frames = Container.Seek(position); foreach (var frame in frames) { Frames[frame.MediaType].Push(frame); } // Resume the clock if it was running before the seek operation OnPropertyChanged(nameof(Position)); if (resumeClock) { Clock.Play(); } Container.Log(MediaLogMessageType.Debug, $"SEEK D: Elapsed: {startTime.DebugElapsedUtc()}"); RequestedSeekPosition = null; SeekingDone.Set(); }
/// <summary> /// Initializes the media block buffers and /// starts packet reader, frame decoder, and block rendering workers. /// </summary> internal void StartWorkers() { // Initialize the block buffers foreach (var t in Container.Components.MediaTypes) { Blocks[t] = new MediaBlockBuffer(Constants.MaxBlocks[t], t); Renderers[t] = Platform.CreateRenderer(t, this); InvalidateRenderer(t); } // Create the renderer for the preloaded subs if (PreloadedSubtitles != null) { Renderers[PreloadedSubtitles.MediaType] = Platform.CreateRenderer(PreloadedSubtitles.MediaType, this); InvalidateRenderer(PreloadedSubtitles.MediaType); } Clock.SpeedRatio = Constants.Controller.DefaultSpeedRatio; Commands.IsStopWorkersPending = false; // Set the initial state of the task cycles. BlockRenderingCycle.Complete(); FrameDecodingCycle.Begin(); PacketReadingCycle.Begin(); // Create the thread runners PacketReadingTask = new Thread(RunPacketReadingWorker) { IsBackground = true, Name = nameof(PacketReadingTask), Priority = ThreadPriority.Normal }; FrameDecodingTask = new Thread(RunFrameDecodingWorker) { IsBackground = true, Name = nameof(FrameDecodingTask), Priority = ThreadPriority.AboveNormal }; // Fire up the threads PacketReadingTask.Start(); FrameDecodingTask.Start(); StartBlockRenderingWorker(); }
/// <inheritdoc /> public void Dispose() { if (m_IsDisposed == true) { return; } m_IsDisposed.Value = true; // Dispose of commands. This closes the // Media automatically and signals an exit // This also causes the Container to get disposed. Commands.Dispose(); // Reset the RTC ResetPosition(); // Dispose the Wait Event objects as they are // backed by unmanaged code PacketReadingCycle.Dispose(); FrameDecodingCycle.Dispose(); BlockRenderingCycle.Dispose(); BufferChangedEvent.Dispose(); }
/// <summary> /// Starts the block rendering worker. /// </summary> private void StartBlockRenderingWorker() { if (BlockRenderingWorkerExit != null) { return; } BlockRenderingWorkerExit = WaitEventFactory.Create(isCompleted: false, useSlim: true); // Holds the main media type var main = Container.Components.MainMediaType; // Holds all components var all = Renderers.Keys.ToArray(); // Holds a snapshot of the current block to render var currentBlock = new MediaTypeDictionary <MediaBlock>(); // Keeps track of how many blocks were rendered in the cycle. var renderedBlockCount = new MediaTypeDictionary <int>(); // wait for main component blocks or EOF or cancellation pending while (CanReadMoreFramesOf(main) && Blocks[main].Count <= 0) { FrameDecodingCycle.Wait(Constants.Interval.LowPriority); } // Set the initial clock position var wallClock = ChangePosition(Blocks[main].RangeStartTime); // Wait for renderers to be ready foreach (var t in all) { Renderers[t]?.WaitForReadyState(); } // The Render timer is responsible for sending frames to renders BlockRenderingWorker = new Timer((s) => { #region Detect Exit/Skip Conditions if (Commands.IsStopWorkersPending || BlockRenderingWorkerExit.IsCompleted || IsDisposed) { BlockRenderingWorkerExit?.Complete(); return; } // Skip the cycle if it's already running if (BlockRenderingCycle.IsInProgress) { Log(MediaLogMessageType.Trace, $"SKIP: {nameof(BlockRenderingWorker)} already in a cycle. {WallClock}"); return; } #endregion #region Run the Rendering Cycle try { #region 1. Control and Capture // Wait for the seek op to finish before we capture blocks Commands.WaitForActiveSeekCommand(); // Signal the start of a block rendering cycle BlockRenderingCycle.Begin(); // Skip the cycle if we are running a priority command if (Commands.IsExecutingDirectCommand) { return; } // Updatete Status Properties main = Container.Components.MainMediaType; all = Renderers.Keys.ToArray(); // Reset the rendered count to 0 foreach (var t in all) { renderedBlockCount[t] = 0; } #endregion #region 2. Handle Block Rendering // capture the wall clock for this cycle wallClock = WallClock; // Capture the blocks to render foreach (var t in all) { // Get the audio, video, or subtitle block to render currentBlock[t] = (t == MediaType.Subtitle && PreloadedSubtitles != null) ? PreloadedSubtitles[wallClock] : currentBlock[t] = Blocks[t][wallClock]; } // Render each of the Media Types if it is time to do so. foreach (var t in all) { // Skip rendering for nulls if (currentBlock[t] == null || currentBlock[t].IsDisposed) { continue; } // Render by forced signal (TimeSpan.MinValue) or because simply it is time to do so if (LastRenderTime[t] == TimeSpan.MinValue || currentBlock[t].StartTime != LastRenderTime[t]) { renderedBlockCount[t] += SendBlockToRenderer(currentBlock[t], wallClock, main); } } #endregion #region 3. Finalize the Rendering Cycle // Call the update method on all renderers so they receive what the new wall clock is. foreach (var t in all) { Renderers[t]?.Update(wallClock); } #endregion } catch { throw; } finally { // Update the Position if (IsWorkerInterruptRequested == false && IsSyncBuffering == false) { State.UpdatePosition(Clock.IsRunning ? wallClock : Clock.Position); } // Always exit notifying the cycle is done. BlockRenderingCycle.Complete(); } #endregion }, this, // the state argument passed on to the ticker 0, Convert.ToInt32(Constants.Interval.HighPriority.TotalMilliseconds)); }
/// <summary> /// Starts the block rendering worker. /// </summary> private void StartBlockRenderingWorker() { if (HasBlockRenderingWorkerExited != null) { return; } HasBlockRenderingWorkerExited = new ManualResetEvent(false); // Synchronized access to parts of the run cycle var isRunningRenderingCycle = false; // Holds the main media type var main = Container.Components.Main.MediaType; // Holds the auxiliary media types var auxs = Container.Components.MediaTypes.ExcludeMediaType(main); // Holds all components var all = Container.Components.MediaTypes.DeepCopy(); // Holds a snapshot of the current block to render var currentBlock = new MediaTypeDictionary <MediaBlock>(); // Keeps track of how many blocks were rendered in the cycle. var renderedBlockCount = new MediaTypeDictionary <int>(); // reset render times for all components foreach (var t in all) { LastRenderTime[t] = TimeSpan.MinValue; } // Ensure packet reading is running PacketReadingCycle.WaitOne(); // wait for main component blocks or EOF or cancellation pending while (CanReadMoreFramesOf(main) && Blocks[main].Count <= 0) { FrameDecodingCycle.WaitOne(); } // Set the initial clock position // TODO: maybe update media start time offset to this Minimum, initial Start Time intead of relying on contained meta? Clock.Update(Blocks[main].RangeStartTime); // .GetMinStartTime() var wallClock = WallClock; // Wait for renderers to be ready foreach (var t in all) { Renderers[t]?.WaitForReadyState(); } // The Render timer is responsible for sending frames to renders BlockRenderingWorker = new Timer((s) => { #region Detect a Timer Stop if (IsTaskCancellationPending || HasBlockRenderingWorkerExited.IsSet() || IsDisposed) { HasBlockRenderingWorkerExited.Set(); return; } #endregion #region Run the Rendering Cycle // Updatete Status Properties State.UpdateBufferingProperties(); // Don't run the cycle if it's already running if (isRunningRenderingCycle) { // TODO: Maybe Log a frame skip here? return; } try { #region 1. Control and Capture // Flag the current rendering cycle isRunningRenderingCycle = true; // Reset the rendered count to 0 foreach (var t in all) { renderedBlockCount[t] = 0; } // Capture current clock position for the rest of this cycle BlockRenderingCycle.Reset(); #endregion #region 2. Handle Block Rendering // Wait for the seek op to finish before we capture blocks if (HasDecoderSeeked) { SeekingDone.WaitOne(); } // capture the wall clock for this cycle wallClock = WallClock; // Capture the blocks to render foreach (var t in all) { currentBlock[t] = Blocks[t][wallClock]; } // Render each of the Media Types if it is time to do so. foreach (var t in all) { // Skip rendering for nulls if (currentBlock[t] == null) { continue; } // Render by forced signal (TimeSpan.MinValue) if (LastRenderTime[t] == TimeSpan.MinValue) { renderedBlockCount[t] += SendBlockToRenderer(currentBlock[t], wallClock); continue; } // Render because we simply have not rendered if (currentBlock[t].StartTime != LastRenderTime[t]) { renderedBlockCount[t] += SendBlockToRenderer(currentBlock[t], wallClock); continue; } } #endregion #region 6. Finalize the Rendering Cycle // Call the update method on all renderers so they receive what the new wall clock is. foreach (var t in all) { Renderers[t]?.Update(wallClock); } #endregion } catch (ThreadAbortException) { /* swallow */ } catch { if (!IsDisposed) { throw; } } finally { // Always exit notifying the cycle is done. BlockRenderingCycle.Set(); isRunningRenderingCycle = false; } #endregion }, this, // the state argument passed on to the ticker 0, (int)Constants.Interval.HighPriority.TotalMilliseconds); }
/// <summary> /// Starts the block rendering worker. /// </summary> private void StartBlockRenderingWorker() { if (BlockRenderingWorkerExit != null) { return; } BlockRenderingWorkerExit = WaitEventFactory.Create(isCompleted: false, useSlim: true); // Synchronized access to parts of the run cycle var isRunningRenderingCycle = false; // Holds the main media type var main = Container.Components.Main.MediaType; // Holds all components var all = Renderers.Keys.ToArray(); // Holds a snapshot of the current block to render var currentBlock = new MediaTypeDictionary <MediaBlock>(); // Keeps track of how many blocks were rendered in the cycle. var renderedBlockCount = new MediaTypeDictionary <int>(); // reset render times for all components foreach (var t in all) { LastRenderTime[t] = TimeSpan.MinValue; } // Ensure packet reading is running PacketReadingCycle.Wait(); // wait for main component blocks or EOF or cancellation pending while (CanReadMoreFramesOf(main) && Blocks[main].Count <= 0) { FrameDecodingCycle.Wait(); } // Set the initial clock position Clock.Update(Blocks[main].RangeStartTime); var wallClock = WallClock; // Wait for renderers to be ready foreach (var t in all) { Renderers[t]?.WaitForReadyState(); } // The Render timer is responsible for sending frames to renders BlockRenderingWorker = new Timer((s) => { #region Detect a Timer Stop if (IsTaskCancellationPending || BlockRenderingWorkerExit.IsCompleted || IsDisposed) { BlockRenderingWorkerExit.Complete(); return; } #endregion #region Run the Rendering Cycle // Updatete Status Properties State.UpdateBufferingProperties(); // Don't run the cycle if it's already running if (isRunningRenderingCycle) { Log(MediaLogMessageType.Trace, $"SKIP: {nameof(BlockRenderingWorker)} alredy in a cycle. {WallClock}"); return; } try { #region 1. Control and Capture // Flag the current rendering cycle isRunningRenderingCycle = true; // Reset the rendered count to 0 foreach (var t in all) { renderedBlockCount[t] = 0; } // Capture current clock position for the rest of this cycle BlockRenderingCycle.Begin(); #endregion #region 2. Handle Block Rendering // Wait for the seek op to finish before we capture blocks if (HasDecoderSeeked) { SeekingDone.Wait(); } // capture the wall clock for this cycle wallClock = WallClock; // Capture the blocks to render foreach (var t in all) { if (t == MediaType.Subtitle && PreloadedSubtitles != null) { // Get the preloaded, cached subtitle block currentBlock[t] = PreloadedSubtitles[wallClock]; } else { // Get the regular audio, video, or sub block currentBlock[t] = Blocks[t][wallClock]; } } // Render each of the Media Types if it is time to do so. foreach (var t in all) { // Skip rendering for nulls if (currentBlock[t] == null) { continue; } // Render by forced signal (TimeSpan.MinValue) or because simply it is time to do so if (LastRenderTime[t] == TimeSpan.MinValue || currentBlock[t].StartTime != LastRenderTime[t]) { renderedBlockCount[t] += SendBlockToRenderer(currentBlock[t], wallClock); continue; } } #endregion #region 6. Finalize the Rendering Cycle // Call the update method on all renderers so they receive what the new wall clock is. foreach (var t in all) { Renderers[t]?.Update(wallClock); } #endregion } catch (ThreadAbortException) { /* swallow */ } catch { if (!IsDisposed) { throw; } } finally { // Always exit notifying the cycle is done. BlockRenderingCycle.Complete(); isRunningRenderingCycle = false; } #endregion }, this, // the state argument passed on to the ticker 0, Convert.ToInt32(Constants.Interval.HighPriority.TotalMilliseconds)); }
/// <summary> /// Continuously converts frmes and places them on the corresponding /// block buffer. This task is responsible for keeping track of the clock /// and calling the render methods appropriate for the current clock position. /// </summary> internal void RunBlockRenderingWorker() { try { #region 0. Initialize Running State // Holds the main media type var main = Container.Components.Main.MediaType; // Holds the auxiliary media types var auxs = Container.Components.MediaTypes.Where(t => t != main).ToArray(); // Holds all components var all = Container.Components.MediaTypes.ToArray(); // Holds a snapshot of the current block to render var currentBlock = new MediaTypeDictionary <MediaBlock>(); // Keeps track of how many blocks were rendered in the cycle. var renderedBlockCount = 0; // reset render times for all components foreach (var t in all) { LastRenderTime[t] = TimeSpan.MinValue; } // Ensure the other workers are running PacketReadingCycle?.WaitOne(); FrameDecodingCycle?.WaitOne(); // Set the initial clock position Clock.Position = Blocks[main].RangeStartTime; var wallClock = Clock.Position; // Wait for renderers to be ready foreach (var t in all) { Renderers[t]?.WaitForReadyState(); } #endregion while (IsTaskCancellationPending == false) { #region 1. Control and Capture // Reset the rendered count to 0 renderedBlockCount = 0; // Capture current clock position for the rest of this cycle BlockRenderingCycle?.Reset(); // capture the wall clock for this cycle wallClock = Clock.Position; #endregion #region 2. Handle Block Rendering // Capture the blocks to render foreach (var t in all) { currentBlock[t] = HasDecoderSeeked ? null : Blocks[t][wallClock]; } // Render each of the Media Types if it is time to do so. foreach (var t in all) { // Skip rendering for nulls if (currentBlock[t] == null) { continue; } // Render by forced signal (TimeSpan.MinValue) if (LastRenderTime[t] == TimeSpan.MinValue) { renderedBlockCount += SendBlockToRenderer(currentBlock[t], wallClock); continue; } // Render because we simply have not rendered if (currentBlock[t].StartTime != LastRenderTime[t]) { renderedBlockCount += SendBlockToRenderer(currentBlock[t], wallClock); continue; } } #endregion #region 6. Finalize the Rendering Cycle // Signal the rendering cycle was set. BlockRenderingCycle?.Set(); // Call the update method on all renderers so they receive what the new wall clock is. foreach (var t in all) { Renderers[t]?.Update(wallClock); } // Delay the thread for a bit if we have no more stuff to process if (IsSeeking == false && renderedBlockCount <= 0 && Commands.PendingCount <= 0) { Task.Delay(1).GetAwaiter().GetResult(); } #endregion } } catch (ThreadAbortException) { } finally { // Always exit notifying the cycle is done. BlockRenderingCycle?.Set(); } }
public async Task CloseAsync() { Container?.Log(MediaLogMessageType.Debug, $"{nameof(CloseAsync)}: Entered"); Clock.Pause(); IsTaskCancellationPending = true; // Wait for cycles to complete. await Task.Run(() => { while (!BlockRenderingCycle.Wait(1)) { } while (!FrameDecodingCycle.Wait(1)) { } while (!PacketReadingCycle.Wait(1)) { } }); BlockRenderingTask?.Join(); FrameDecodingTask?.Join(); PacketReadingTask?.Join(); BlockRenderingTask = null; FrameDecodingTask = null; PacketReadingTask = null; foreach (var renderer in Renderers.Values) { renderer.Close(); } Renderers.Clear(); // Reset the clock Clock.Reset(); Container?.Log(MediaLogMessageType.Debug, $"{nameof(CloseAsync)}: Completed"); // Dispose the container if (Container != null) { Container.Dispose(); Container = null; } // Dispose the Blocks for all components foreach (var kvp in Blocks) { kvp.Value.Dispose(); } Blocks.Clear(); // Dispose the Frames for all components foreach (var kvp in Frames) { kvp.Value.Dispose(); } Frames.Clear(); // Clear the render times LastRenderTime.Clear(); // Update notification properties UpdateMediaProperties(); MediaState = MediaState.Close; }
/// <summary> /// Opens the specified media Asynchronously /// </summary> /// <param name="uri">The URI.</param> /// <returns></returns> private async Task OpenAsync(Uri uri) { try { await Task.Run(() => { var mediaUrl = uri.IsFile ? uri.LocalPath : uri.ToString(); Container = new MediaContainer(mediaUrl); RaiseMediaOpeningEvent(); Container.Log(MediaLogMessageType.Debug, $"{nameof(OpenAsync)}: Entered"); Container.Initialize(); }); foreach (var t in Container.Components.MediaTypes) { Blocks[t] = new MediaBlockBuffer(MaxBlocks[t], t); Frames[t] = new MediaFrameQueue(); LastRenderTime[t] = TimeSpan.MinValue; Renderers[t] = CreateRenderer(t); } IsTaskCancellationPending = false; BlockRenderingCycle.Set(); FrameDecodingCycle.Set(); PacketReadingCycle.Set(); PacketReadingTask = new Thread(RunPacketReadingWorker) { IsBackground = true }; FrameDecodingTask = new Thread(RunFrameDecodingWorker) { IsBackground = true }; BlockRenderingTask = new Thread(RunBlockRenderingWorker) { IsBackground = true }; PacketReadingTask.Start(); FrameDecodingTask.Start(); BlockRenderingTask.Start(); RaiseMediaOpenedEvent(); if (LoadedBehavior == MediaState.Play) { Play(); } } catch (Exception ex) { RaiseMediaFailedEvent(ex); } finally { UpdateMediaProperties(); Container.Log(MediaLogMessageType.Debug, $"{nameof(OpenAsync)}: Completed"); } }
/// <summary> /// Starts the block rendering worker. /// </summary> private void StartBlockRenderingWorker() { if (HasBlockRenderingWorkerExited != null) { return; } HasBlockRenderingWorkerExited = new ManualResetEvent(false); // Synchronized access to parts of the run cycle var isRunningPropertyUpdates = false; var isRunningRenderingCycle = false; // Holds the main media type var main = Container.Components.Main.MediaType; // Holds the auxiliary media types var auxs = Container.Components.MediaTypes.ExcludeMediaType(main); // Holds all components var all = Container.Components.MediaTypes.DeepCopy(); // Holds a snapshot of the current block to render var currentBlock = new MediaTypeDictionary <MediaBlock>(); // Keeps track of how many blocks were rendered in the cycle. var renderedBlockCount = new MediaTypeDictionary <int>(); // reset render times for all components foreach (var t in all) { LastRenderTime[t] = TimeSpan.MinValue; } // Ensure the other workers are running PacketReadingCycle.WaitOne(); FrameDecodingCycle.WaitOne(); // Set the initial clock position Clock.Position = Blocks[main].RangeStartTime; var wallClock = Clock.Position; // Wait for renderers to be ready foreach (var t in all) { Renderers[t]?.WaitForReadyState(); } // The Property update timer is responsible for timely updates to properties outside of the worker threads BlockRenderingWorker = new Timer((s) => { #region Detect a Timer Stop if (IsTaskCancellationPending || HasBlockRenderingWorkerExited.IsSet() || m_IsDisposing.Value) { HasBlockRenderingWorkerExited.Set(); return; } #endregion #region Run the property Updates if (isRunningPropertyUpdates == false) { isRunningPropertyUpdates = true; try { UpdatePosition(IsOpen ? Clock?.Position ?? TimeSpan.Zero : TimeSpan.Zero); UpdateBufferingProperties(); } catch (Exception ex) { Log(MediaLogMessageType.Error, $"{nameof(BlockRenderingWorker)} callabck failed. {ex.GetType()}: {ex.Message}"); } finally { isRunningPropertyUpdates = false; } } #endregion #region Run the Rendering Cycle // Don't run the cycle if it's already running if (isRunningRenderingCycle) { // TODO: Log a frame skip return; } try { #region 1. Control and Capture // Flag the current rendering cycle isRunningRenderingCycle = true; // Reset the rendered count to 0 foreach (var t in all) { renderedBlockCount[t] = 0; } // Capture current clock position for the rest of this cycle BlockRenderingCycle.Reset(); // capture the wall clock for this cycle wallClock = Clock.Position; #endregion #region 2. Handle Block Rendering // Wait for the seek op to finish before we capture blocks if (HasDecoderSeeked) { SeekingDone.WaitOne(); } // Capture the blocks to render foreach (var t in all) { currentBlock[t] = Blocks[t][wallClock]; } // Render each of the Media Types if it is time to do so. foreach (var t in all) { // Skip rendering for nulls if (currentBlock[t] == null) { continue; } // Render by forced signal (TimeSpan.MinValue) if (LastRenderTime[t] == TimeSpan.MinValue) { renderedBlockCount[t] += SendBlockToRenderer(currentBlock[t], wallClock); continue; } // Render because we simply have not rendered if (currentBlock[t].StartTime != LastRenderTime[t]) { renderedBlockCount[t] += SendBlockToRenderer(currentBlock[t], wallClock); continue; } } #endregion #region 6. Finalize the Rendering Cycle // Call the update method on all renderers so they receive what the new wall clock is. foreach (var t in all) { Renderers[t]?.Update(wallClock); } #endregion } catch (ThreadAbortException) { } catch { throw; } finally { // Always exit notifying the cycle is done. BlockRenderingCycle.Set(); isRunningRenderingCycle = false; } #endregion }, this, // the state argument passed on to the ticker 0, (int)Constants.Interval.HighPriority.TotalMilliseconds); }