public virtual void Acquire() { if (GlobalIsRunning.IsRunning == false) { return; } try { m_log.Debug(Context.Name + ": acquiring"); Stopwatch watch = Stopwatch.StartNew(); CollectedData cd = OnAcquire(); watch.Stop(); //Debug.Assert(cd != null); m_log.Debug(string.Format("{0}: acquisition took {1} ms", Context.Name, watch.ElapsedMilliseconds)); watch = Stopwatch.StartNew(); NotifyOfDataAcquired(cd); watch.Stop(); m_log.Debug(string.Format("{0}: notification took {1} ms", Context.Name, watch.ElapsedMilliseconds)); } catch (Exception e) { m_log.Error(e); } }
protected void NotifyOfDataAcquired(CollectedData cd) { lock (m_lock) { OnDataAcquired?.Invoke(cd); } }