示例#1
0
 /// <summary>
 /// Removes this job from the JobManager, if it has not yet began working. There is no way to restart an aborted job, a new one must be created.
 /// Locks: this.SyncRoot->JobManager.m_ThreadStatsLock
 /// </summary>
 public void Abort()
 {
     try
     {
         using (TimedLock.Lock(SyncRoot))                 // this.SyncRoot
         {
             m_Worker = null;
             m_Status = JobStatus.Aborted;
             JobManager.AbortedJobs++;
         }
     }
     catch (LockTimeoutException e)
     {
         Console.WriteLine("\n\nDeadlock detected!\n");
         Console.WriteLine(e.ToString());
     }
 }
示例#2
0
        /// <summary>
        /// Calls the work-completed delegate.
        /// Locks: this->SyncRoot
        /// </summary>
        internal void DoCompleted()
        {
            try
            {
                JobCompletedCallback cb;
                using (TimedLock.Lock(SyncRoot)) // this.SyncRoot
                {
                    if (m_Completed == null)
                    {
                        return;
                    }

                    cb = m_Completed;
                }

                cb(this);
            }
            catch (Exception e)
            {
                System.Console.WriteLine("Exception Caught in JobManager code: " + e.Message);
                System.Console.WriteLine(e.StackTrace);
            }
        }