Exemplo n.º 1
0
        /// <summary>
        /// 注册心跳
        /// </summary>
        /// <param name="func"></param>
        /// <param name="intervalMS"></param>
        /// <param name="count"></param>
        /// <param name="tag"></param>
        /// <param name="rsv"></param>
        /// <returns></returns>
        public int Reg(Action <float> func, int delay, int intervalMS,
                       int count  = -1,
                       object tag = null,
                       object rsv = null)
        {
            TimerEntry timer;
            int        tId;

            if (count == -1)
            {
                timer = new TimerEntry(delay, intervalMS, func);
                timer.Start();
                tId = timer.Id;
            }
            else
            {
                timer = new TimerEntry(delay, intervalMS, func, count);
                timer.Start();
                tId = timer.Id;
            }

            //Monitor.Enter(_tempUpdateTables);
            _tempUpdateTables.Add(timer);
            //Monitor.Exit(_tempUpdateTables);
            return(tId);
        }
Exemplo n.º 2
0
 public bool Equals(TimerEntry obj)
 {
     return(obj.Interval == Interval && Equals(obj.Action, Action));
 }