コード例 #1
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    // dispose of the processing thread
                    _processingThread.Dispose();
                    _processingThread = null;

                    // dispose of all of the thread pool threads
                    this.DestroyThreads(false /* all threads */);
                }
                _disposed = true;
            }
        }
コード例 #2
0
 /// <summary>
 /// Destroys the specified thread
 /// </summary>
 /// <param name="thread"></param>
 /// <param name="force"></param>
 protected virtual void DestroyThread(BackgroundThread thread, bool force)
 {
     try
     {
         if (thread != null)
         {
             if (thread.IsFinished || force)
             {
                 thread.Dispose();
             }
         }
     }
     catch (ThreadAbortException)
     {
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
     }
 }
コード例 #3
0
		/// <summary>
		/// Destroys the specified thread
		/// </summary>
		/// <param name="thread"></param>
		/// <param name="force"></param>
		protected virtual void DestroyThread(BackgroundThread thread, bool force)
		{
			try
			{
				if (thread != null)
					if (thread.IsFinished || force)
						thread.Dispose();
			}
			catch(ThreadAbortException)
			{
			}
			catch(Exception ex)
			{
				Debug.WriteLine(ex);
			}
		}