Beispiel #1
0
 public static void AddTask(Runnable r)
 {
     lock (tasks)
     {
         tasks.AddFirst(r);
         Monitor.Pulse(tasks);
     }
 }
Beispiel #2
0
 public void AddTask(Runnable task, long waitsecds)
 {
     lock (ilock)
     {
         long timestamp = waitsecds + elapse;
         LinkedList<Runnable> tasklist;
         if (tasks.TryGetValue(timestamp, out tasklist))
         {
             tasklist.AddLast(task);
         }
         else
         {
             tasklist = new LinkedList<Runnable>();
             tasklist.AddLast(task);
             tasks.Add(timestamp, tasklist);
         }
     }
 }
Beispiel #3
0
 public static void AddTimerTask(Runnable task, long waitsecds)
 {
     instance.AddTask(task, waitsecds);
 }