private MediaTimer(System.DateTime dtDue, DelegateTimerFired del, string strGuid, ILogInterface logmgr) { DueTime = dtDue; CallBack = del; Id = Interlocked.Increment(ref BaseTimerId); Guid = strGuid; m_logmgr = logmgr; }
private MediaTimer(System.DateTime dtDue, DelegateTimerFired del, string strGuid, object objTag) { DueTime = dtDue; CallBack = del; Id = Interlocked.Increment(ref BaseTimerId); Guid = strGuid; m_logmgr = null; Tag = objTag; }
internal QuickTimer(PeriodicTimerWatch objWatch, int nMsTimer, DelegateTimerFired del, string strGuid, ILogInterface logmgr) { Period = nMsTimer; watch = objWatch; CallBack = del; Id = Interlocked.Increment(ref BaseTimerId); Guid = strGuid; m_logmgr = logmgr; m_bCanceled = false; }
public void Cancel() { lock (TimerLock) { if (SortedTimers.Contains(this)) { SortedTimers.Remove(this); EventNewTimer.Set(); } } this.CallBack = null; }
public static IMediaTimer CreateTimer(int nMilliseconds, DelegateTimerFired del, string strGuid, ILogInterface logmgr, int nAvgDevMs) { int nIndex = 0; lock (LockCurrentTimerThread) { CurrentTimerThread++; if (CurrentTimerThread > (Timers.Count - 1)) { CurrentTimerThread = 0; } nIndex = CurrentTimerThread; } return(Timers[nIndex].CreateTimer(nMilliseconds, del, strGuid, logmgr, nAvgDevMs)); }
public void Fire() { try { if (CallBack != null) { CallBack.DynamicInvoke(new object[] { this }); //invoke our self if we have no host CallBack = null; } } catch (System.NullReferenceException e) { if (m_logmgr != null) { m_logmgr.LogError(Guid, MessageImportance.Highest, string.Format("Exception in timer thread: {0}", e)); } } }
public static IMediaTimer CreateTimer(int nMilliseconds, DelegateTimerFired del, string strGuid, object objTag) { lock (LockInit) { if (Initialized == false) { PrepareStuff(); Initialized = true; } } System.DateTime dtDue = DateTime.Now.AddMilliseconds(Convert.ToDouble(nMilliseconds)); MediaTimer objNewTimer = new MediaTimer(dtDue, del, strGuid, objTag); AddSorted(objNewTimer); return(objNewTimer); }
public IMediaTimer CreateTimer(int nMilliseconds, DelegateTimerFired del, string strGuid, ILogInterface logmgr, int nAvgDevMs) { lock (LockInit) { if (Initialized == false) { PrepareStuff(); Initialized = true; } } PeriodicTimerWatch watch = null; lock (GlobalWatchesLock) { if (GlobalWatches.ContainsKey(nMilliseconds) == false) { watch = new PeriodicTimerWatch(nMilliseconds); GlobalWatches.Add(nMilliseconds, watch); GlobalWatchesSorted.Add(watch); foreach (PeriodicTimerWatch nextwatch in GlobalWatchesSorted) { nextwatch.LockTimeForSort(); } GlobalWatchesSorted.Sort(); EventNewTimer.Set(); } else { watch = GlobalWatches[nMilliseconds]; } } QuickTimer objNewTimer = new QuickTimer(watch, nMilliseconds, del, strGuid, logmgr, nAvgDevMs); watch.AddTimer(objNewTimer); return(objNewTimer); }
public void Fire() { try { if (CallBack != null) { CallBack.DynamicInvoke(new object[] { this }); //invoke our self if we have no host CallBack = null; } } catch (System.NullReferenceException e) { if (m_logmgr != null) m_logmgr.LogError(Guid, MessageImportance.Highest, string.Format("Exception in timer thread: {0}", e)); } }
public static IMediaTimer CreateTimer(int nMilliseconds, DelegateTimerFired del, string strGuid, object objTag) { lock (LockInit) { if (Initialized == false) { PrepareStuff(); Initialized = true; } } System.DateTime dtDue = DateTime.Now.AddMilliseconds(Convert.ToDouble(nMilliseconds)); MediaTimer objNewTimer = new MediaTimer(dtDue, del, strGuid, objTag); AddSorted(objNewTimer); return objNewTimer; }