/**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); }
public CaptureThread(CaptureThreadEnv tmpEnv) { boardId = (uint)tmpEnv.boardId; init = tmpEnv.init; clean = tmpEnv.clean; status = tmpEnv.status; outputQueue = tmpEnv.captureOutQueue; pkgCounter = 0; thread = new Thread(captureFunc); thread.IsBackground = true; }
/** * Set the enviroment of the capture thread. * @param thrdEnv the capture environment to be set * @param index the index of capture thread in thread list * @return thrdEnv a capture thread environment whose paraments are set */ private void setCaptureThreadEnv(CaptureThreadEnv threadEnv, int indexOfThreadList) { int count = queueManager.captureOutList.Count; if (indexOfThreadList >= count) { return; } threadEnv.init = threadHandClaspInit; threadEnv.clean = threadHandClaspCleanup; threadEnv.status = ThreadCondition.created; threadEnv.captureOutQueue = queueManager.captureOutList[indexOfThreadList]; threadEnv.boardId = indexOfThreadList; }