Beispiel #1
0
 public static void AddJobToQueue(BackgroundJob job)
 {
     //Logger.Info("adding job " + job.Event.Description + " to backgorund queue");
     BackgroundWorkerQueue.Enqueue(job);
     MainEvent.Set();
     MainEvent.Reset(); // must call reset right after set, else the next call to WaitOne will not block
 }
Beispiel #2
0
        public static void StopWorkers()
        {
            CancelToken.Cancel();
            MainEvent.Set();

            while (Tasks.Count(t => TaskHasEnded(t) == false) > 0)
            {
                Console.WriteLine("Waiting for tasks to complete");
                Thread.Sleep(1000);
            }
        }