/* $Id: //depot/tools/main/performance/perfstat_cluster/src/controller.cpp#14 $ */ #include controller::controller() { parallelCmdDone = false; finishedParallelStats = false; startPreStatsCmd = false; } void controller::waitParallelCmdThread() { boost::mutex::scoped_lock lk(cmdMutex); if (!parallelCmdDone) { while (!parallelCmdDone) cond.wait(lk); } } void controller::parallelCmdThreadFinish() { boost::mutex::scoped_lock lk(cmdMutex); if (!parallelCmdDone) { parallelCmdDone = true; cond.notify_all(); } } void controller::waitForPreStatsCommands() { boost::mutex::scoped_lock lk(cmdPreStatsMutex); if (!startPreStatsCmd) { while (!startPreStatsCmd) condPreStats.wait(lk); } } void controller::startPreStatsCommands() { boost::mutex::scoped_lock lk(cmdPreStatsMutex); if (!startPreStatsCmd) { startPreStatsCmd = true; condPreStats.notify_all(); } } void controller::waitParallelStatsCmdThread() { boost::mutex::scoped_lock lks(cmdStatsMutex); if (!finishedParallelStats) { while (!finishedParallelStats) condStats.wait(lks); } } void controller::parallelStatsCmdThreadFinish() { boost::mutex::scoped_lock lk(cmdStatsMutex); if (!finishedParallelStats) { finishedParallelStats = true; condStats.notify_all(); } } void controller::resetPrestatVariable() { boost::mutex::scoped_lock lk(resetVarMutex); startPreStatsCmd = false; }