Java : スレッドプログラミング
Javaでwait()とnotify()を使う際のお作法って、こんな感じでいいのかな?
class Something { private Integer value = null; public int wait_and_return() { if (value == null) { wait_for_value(); } return value; } private synchronized wait_for_value() { while (value == null) { try { wait(100); }catch(InterruptedException e) {} } } }
追記)try ... catchを忘れていた・・・、ので追記。