public int GetQueueLength(int id) { LinkedBlockingCollection <BabelMessage> q = GetQueue(id); if (q != null) { return(q.Size()); } return(0); }
// When playing cache count = total size = CurrentRelativeChartCacheIndex, // whereas CurrentPlayIndex is somewhere inbetween. // Need to show AP series up to that point. // When playing, updates ActualPos (AP) series only, otherwise both. // Uses NaN's to mask out unused series points. private void UpdateSeries() { try { while (!IsClosing && ChartPlotter != null && (AxisPointTaskQueue.Size() > 0)) { RecorderAxisPoint rap = AxisPointTaskQueue.Take(); if (rap != null && !IsClosing) { AxisPortProperties ap = rap.SeriesAxisPortPorperties; List <double> p = rap.AxisPoint; bool isTarget = rap.IsTarget; if (rap.SeriesResetRequired) { ResetSeries(); } foreach (AxisProperties a in ap.AxesOnPort) { if (rap.UpdateSeries) { if (isTarget) { if (a.TargetSeries != null) { try { double yt = p[a.DataPVTOffset + 1]; if (!Double.IsNaN(yt)) { UpdateSeries(a.TargetSeries, p[0], yt); } } catch (Exception) { // Index out of range. } } } else { if (a.ActualSeries != null) { try { double ya = p[a.DataPVTOffset]; if (!Double.IsNaN(ya)) { UpdateSeries(a.ActualSeries, p[0], ya); } } catch (Exception) { // Index out of range. } } } } if (!isTarget) { try { Recorder.UpdateAxisPosition(a.AxisId, p[a.DataPVTOffset]); } catch (Exception) { // Index out of range. } } } } } } catch (ThreadInterruptedException) { } catch (Exception e) { if (IsClosing) { return; } // ignore. Log.d(TAG, "UpdateSeries exception:" + e.Message); } }