X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/9523acd2d7be7b8bbbf6d8c786c68c91f9fcc700..c0e0cf58ce033421d125afb813636f102456592c:/Server/src/plant.cpp?ds=inline 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 {