CounDownLatch
それぞれが同じ実行可能クラスを持つ 2 つの異なるスレッドに を使用する方法は?? FICS と fiCS_R7 を同じ実行可能なクラス FICS にしたいのですが、fiCS_R3 が終了すると fiCS_R7 が開始されます。
どうやってやるの。
コード:
public FICSFilter(Mat bgrMat, int csRadius) {
// TODO Auto-generated constructor stub
this.bgrMat = bgrMat;
this.csRadius = csRadius;
CountDownLatch latch = new CountDownLatch(1);
this.fiCS_R3 = new Thread(new FICS(this.bgrMat, 3), "FICS_R" + this.csRadius);
fiCS_R3.start();
this.fiCS_R3 = new Thread(new FICS(this.bgrMat, 7), "FICS_R" + this.csRadius);
fiCS_R7.start();
//How to use the CounDownLatch for two different threads each of them has the same runnable class
}
private class FICS implements Runnable {
private Mat bgrMat;
private int csRadius;
public FICS(Mat bgrMat, int csRadius) {
// TODO Auto-generated constructor stub
this.bgrMat = bgrMat;
this.csRadius = csRadius;
}
public void run() {
// TODO Auto-generated method stub
calcFICS(this.bgrMat, this.csRadius);
}
public static void calcFICS(Mat bgrMat, int csRadius) {
// TODO Auto-generated method stub
ArrayList<Mat> onOffCSActRegMatsList = null;
ArrayList<Mat> offOnCSActRegMatsList = null;
ArrayList<Mat> onOffCSFullMatsList = null;
ArrayList<Mat> offOnCSFullMatsList = null;
onOffCSActRegMatsList = new ArrayList<Mat>();
offOnCSActRegMatsList = new ArrayList<Mat>();