X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/a9d033a0a6748c192d30c9c65ebcc8b1a96cd43b..0d72fb12dc9a570be45e2f25320ac49f604c3ed2:/Server/src/plant.cpp?ds=sidebyside diff --git a/Server/src/plant.cpp b/Server/src/plant.cpp index 69ce671..e46e692 100644 --- a/Server/src/plant.cpp +++ b/Server/src/plant.cpp @@ -76,12 +76,15 @@ void Plant::real_run(void) { cerr << __FILE__ << ": real_run." << endl; #endif // DEBUG while (!stop) { + simulator_mutex.lock(); simulator.simulate(); - Glib::Mutex::Lock lock(transmissions_mutex); + simulator_mutex.unlock(); + transmissions_mutex.lock(); for (TransmitterList::iterator i = transmissions.begin(); i != transmissions.end(); i++) { (*i)->send(simulator.get_state_as_xml()); } + transmissions_mutex.unlock(); Glib::usleep(1000000); } } @@ -119,6 +122,11 @@ bool Plant::transmission_stop(const string& host, return false; // No la encontrĂ³. } +bool Plant::set_open(const std::string& element, bool open) { + Glib::Mutex::Lock lock(simulator_mutex); + return simulator.set_open(element, open); +} + const string Plant::get_xml(void) const { ostringstream oss; try {