/// <summary> /// Thread entry point /// </summary> /// <param name="data"></param> private void ProcessAnalysisJobInternal(object data) { AnalysisJob analysisData = data as AnalysisJob; ProcessAnalysisJobInternal(analysisData.Analysis, analysisData.Options, analysisData.Predictor); // Once the thread is complete...kill the job lock (m_threadpool) { bool hasAnalysis = m_threadpool.ContainsKey(analysisData.Analysis); if (hasAnalysis) { m_threadpool.Remove(analysisData.Analysis); } } if (AnalysisCompleted != null) { AnalysisCompleted(this, new AnalysisCompletedEventArgs(1, 1, analysisData.Analysis)); } }
/// <summary> /// Processes an analysis job (SEQUEST or X!Tandem) /// </summary> /// <param name="analysis">Job to process</param> /// <param name="options">Options to use for processing.</param> /// <param name="massTagDatabase">Mass tag database to update.</param> /// <returns>True if successful, false if processing failed.</returns> public void ProcessAnalysisJob(Analysis analysis, Options options, IRetentionTimePredictor predictor) { lock (m_threadpool) { bool hasAnalysis = m_threadpool.ContainsKey(analysis); if (hasAnalysis) { return; } ParameterizedThreadStart start = new ParameterizedThreadStart(ProcessAnalysisJobInternal); Thread analysisthread = new Thread(start); AnalysisJob data = new AnalysisJob(); data.Analysis = analysis; data.Options = options; data.Predictor = predictor; analysisthread.Start(data); m_threadpool.Add(analysis, analysisthread); } }