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; } }
/// <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); } }
/// <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); } }