/// <summary> /// Starts the first thread from the thread queue /// </summary> private void StartThread() { Logger.Trace("COM: Starting thread..."); _isThreadRunning = true; _conversionThread = ThreadQueue.Dequeue(); _conversionThread.OnThreadFinished += ConversionThreadFinished; _conversionThread.Start(); }
#pragma warning restore CS0067 /// <summary> /// Adds and starts a synchronized thread to the thread list. The application will wait for all of these to end before /// it terminates /// </summary> /// <param name="thread">A thread that needs to be synchronized. This thread will not be automatically started</param> public void StartSynchronizedThread(ISynchronizedThread thread) { if (_isShuttingDown) { _logger.Warn("Tried to start thread while shutdown already started!"); return; } _logger.Debug("Adding thread " + thread.Name); _threads.Enqueue(thread); if (thread.ThreadState == ThreadState.Unstarted) { thread.Start(); } }
/// <summary> /// Adds and starts a synchronized thread to the thread list. The application will wait for all of these to end before /// it terminates /// </summary> /// <param name="thread">A thread that needs to be synchronized. This thread will not be automatically started</param> public void StartSynchronizedThread(ISynchronizedThread thread) { lock (LockObject) { if (_isShuttingDown) { _logger.Warn("Tried to start thread while shutdown already started!"); return; } _logger.Debug("Adding thread " + thread.Name); _threads.Add(thread); thread.OnThreadFinished += thread_OnThreadFinished; if (thread.ThreadState == ThreadState.Unstarted) { thread.Start(); } } }