Exemple #1
0
        static void ProcessJobThread()
        {
            while (true)
            {
                CurrentJob = null;

                if (suspend_count > 0)
                {
                    Task.Delay(10);
                    continue;
                }

                lock (this_mutex) {
                    if (disposed)
                    {
                        Log.Debug("execution thread destroyed, dispose requested");
                        return;
                    }

                    try {
                        CurrentJob = heap.Pop();
                    } catch (InvalidOperationException) {
                        Debug("execution thread destroyed, no more jobs scheduled");
                        job_thread = null;
                        return;
                    }
                }

                try {
                    Debug("Job started ({0})", CurrentJob);
                    OnJobStarted(CurrentJob);
                    CurrentJob.Run();
                    Debug("Job ended ({0})", CurrentJob);
                    OnJobFinished(CurrentJob);
                } catch (Exception e) {
                    Debug("Job threw an unhandled exception: {0}", e);
                }
            }
        }
        private static void ProcessJobThread()
        {
            while (true)
            {
                current_running_job = null;

                if (suspend_count > 0)
                {
                    Thread.Sleep(10);
                    continue;
                }

                lock (this_mutex) {
                    if (disposed)
                    {
                        Console.WriteLine("execution thread destroyed, dispose requested");
                        return;
                    }

                    try {
                        current_running_job = heap.Pop();
                    } catch (InvalidOperationException) {
                        Debug("execution thread destroyed, no more jobs scheduled");
                        job_thread = null;
                        return;
                    }
                }

                try {
                    Debug("Job started ({0})", current_running_job);
                    OnJobStarted(current_running_job);
                    current_running_job.Run();
                    Debug("Job ended ({0})", current_running_job);
                    OnJobFinished(current_running_job);
                } catch (Exception e) {
                    Debug("Job threw an unhandled exception: {0}", e);
                }
            }
        }
Exemple #3
0
        private static void ProcessJobThread()
        {
            while (true)
            {
                current_running_job = null;

                if (suspend_count > 0)
                {
                    Thread.Sleep(10);
                    continue;
                }

                lock (this_mutex) {
                    if (disposed)
                    {
                        job_thread = null;
                        return;
                    }

                    try {
                        current_running_job = heap.Pop();
                    } catch (InvalidOperationException) {
                        job_thread = null;
                        return;
                    }
                }

                try {
                    OnJobStarted(current_running_job);
                    current_running_job.Run();
                    OnJobFinished(current_running_job);
                } catch (Exception e) {
                    Log.Exception(e);
                }
            }
        }
Exemple #4
0
 public override T Pop()
 {
     lock (heap) { return(heap.Pop()); }
 }