« 3.1.1. pfi::concurrent::chan :: Contents :: 3.1.3. pfi::concurrent::lock »
条件変数を扱うためのクラス
mutexにロックをかけcondition::waitにそれを渡せば、 そのconditionがsignalされるまで待つことができる。
mutex m; condition c; synchronized(m){ if (!hoge) c.wait(m); // cで待つ ... c.notify_all(); // 他の待ってる人を起こす }
時限付きwaitもできる。
if (!c.wait(m, 10)) // 10秒だけ待ってみる