/**Initial the capture threads and dispens threads according to the thread environment.*/ private void initPrimaryThreads() { for (int i = 0; i < sessionNum; i++) { CaptureThreadEnv tmpCaptureThreadEnv = new CaptureThreadEnv(); setCaptureThreadEnv(tmpCaptureThreadEnv, i); CaptureThread captureThread = new CaptureThread(tmpCaptureThreadEnv); captureThreadList.Add(captureThread); ParseThreadEnv tmpParseThreadEnv = new ParseThreadEnv(); setParseThreadEnv(tmpParseThreadEnv, i); ParseThread parseThread = new ParseThread(tmpParseThreadEnv); parseThreadList.Add(parseThread); } MergeThreadEnv tmpMergeThreadEvn = new MergeThreadEnv(); setMergeThreadEnv(tmpMergeThreadEvn); mergeThread = new MergeThread(tmpMergeThreadEvn); AscanUIThreadEnv tmpAscanUIThreadEnv = new AscanUIThreadEnv(); setAscanUIThreadEnv(tmpAscanUIThreadEnv); AscanUIThread = new AscanUIThread(tmpAscanUIThreadEnv); MeasureUIThreadEnv tmpMeasureUIThreadEnv = new MeasureUIThreadEnv(); setMeasureUIThreadEnv(tmpMeasureUIThreadEnv); measureUIThread = new MeasureUIThread(tmpMeasureUIThreadEnv); }
/** * Set the enviroment of the parse thread. * @param thrdEnv the parse environment to be set * @param index the index of parse thread in thread list * @return thrdEnv a parse thread environment whose paraments are set */ private void setParseThreadEnv(ParseThreadEnv threadEnv, int indexOfThreadList) { int count = queueManager.captureOutList.Count; if (indexOfThreadList >= count) { return; } threadEnv.init = threadHandClaspInit; threadEnv.clean = threadHandClaspCleanup; threadEnv.status = ThreadCondition.created; threadEnv.index = indexOfThreadList; threadEnv.captureOutQueue = queueManager.captureOutList[indexOfThreadList]; threadEnv.ascanQueue = queueManager.ascanList[indexOfThreadList]; threadEnv.mergeInQueue = queueManager.mergeInList[indexOfThreadList]; }
public ParseThread(ParseThreadEnv tmpEnv) { timer.Elapsed += new System.Timers.ElapsedEventHandler(UpdateAscan); timer.AutoReset = true; init = tmpEnv.init; clean = tmpEnv.clean; status = tmpEnv.status; inputQueue = tmpEnv.captureOutQueue; ascanQueue = tmpEnv.ascanQueue; mergeInQueue = tmpEnv.mergeInQueue; mergeInQueueElement = new MergeInQueueElement(); ascanQueueElement = new AscanQueueElement(); boardStatusPacket = new BoardStatusSetPacket(); thread = new Thread(parseFunc); thread.IsBackground = true; updateCallBack = new updateDelegate(FormList.MDIChild.updateAscanbytimer); }