Exemplo n.º 1
0
        /// <summary>
        /// 重啟主要工作執行緒
        /// </summary>
        public void Reboot()
        {
            if (IsIdle)
            {
                loop = Task.Run(() => {
                    while (jobQueue.Count > 0)
                    {
                        var current = jobQueue[0];
                        current.Invoke();

                        try {
                            current.Task.Wait();
                        } catch { }

                        Remove(current);

                        OnCompleteJob?.Invoke(this);
                    }
                });
            }
        }
Exemplo n.º 2
0
 private void Work_OnCompleteJob(IWorker worker)
 {
     AssignJobs(Workers, _jobQueue);
     OnCompleteJob?.Invoke(this);
 }