0
最初のスレッドを2つ作成してアプリケーション を呼び出し、2番目のスレッドを作成して、最初のスレッドでアプリケーションを呼び出した結果の読み取りファイルを作成します。 アプリケーションの呼び出しはうまく動作しますが、ファイルが正常に動作しないことを確認してください。ここでスレッド同期
は私のコードです:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package reciverwindow;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
*
*/
public class NewClass1 implements Runnable {
public static void main(String[] args) {
CallMatlab c = new CallMatlab();
CUI m = new CUI();
Thread t1 = new Thread(c);
t1.start();
Thread t2 = new Thread(m);
t2.start();
/* try {
t2.sleep(3);
} catch (InterruptedException ex) {
Logger.getLogger(NewClass1.class.getName()).log(Level.SEVERE, null, ex);
}
}*/
synchronized (t2) {
try {
t2.wait(3);
t2.notifyAll();
} catch (InterruptedException ex) {
Logger.getLogger(NewClass1.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
public void run() {
throw new UnsupportedOperationException("Not supported yet.");
}
}
あなたは「ファイルを読んでいない」と言うと、うまくいかないコードを投稿して、何が起こり、何が起こるかを教えてくれるかもしれません。 –