示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tid"></param>
        /// <param name="taskbase"></param>
        static public void AddTimerTask(long tid, TimerTaskModel taskbase)
        {
            SzThread tm = GetThreadModel(tid);

            if (tm != null)
            {
                tm.AddTimerTask(taskbase);
            }
        }
示例#2
0
        /// <summary>
        /// 取消一个任务,键不存在,返回null
        /// </summary>
        /// <param name="timerId"></param>
        public TimerTaskModel RemoveTimerTask(long timerId)
        {
            TimerTaskModel timer = null;

            if (timerTaskQueue.TryGetValue(timerId, out timer))
            {
                timer.Cancel = true;
                return(timer);
            }
            return(null);
        }
示例#3
0
 /// <summary>
 /// 加入任务
 /// </summary>
 /// <param name="timer"></param>
 public void AddTimerTask(TimerTaskModel timer)
 {
     timer.RunAttribute["lastactiontime"] = Utils.TimeUtil.CurrentTimeMillis();
     if (timer.IsStartAction)
     {
         /*立马执行一次*/
         AddTask(timer);
     }
     /*添加队列*/
     timerTaskQueue.TryAdd(timer.ID, timer);
 }
示例#4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="taskbase"></param>
 static public void AddGlobTimerTask(TimerTaskModel taskbase)
 {
     Init();
     backThreadTools.AddTimerTask(taskbase);
 }
示例#5
0
 /// <summary>
 /// 取消一个任务
 /// </summary>
 /// <param name="timer"></param>
 static public TimerTaskModel RemoveTimerTask(long tid, TimerTaskModel timer)
 {
     return(RemoveTimerTask(tid, timer.ID));
 }
示例#6
0
 /// <summary>
 /// 取消一个任务
 /// </summary>
 /// <param name="t"></param>
 public TimerTaskModel RemoveTimerTask(TimerTaskModel t)
 {
     return(RemoveTimerTask(t.ID));
 }