]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Server/src/plant.cpp
se borran las lineas al eliminar un item, esto no esta totalmente testeado
[z.facultad/75.42/plaqui.git] / Server / src / plant.cpp
index 69ce671c511c442be112a5580b78d2c8ac7f160c..e46e692671fb7dc864a909e7862b4f338794ee49 100644 (file)
@@ -76,12 +76,15 @@ void Plant::real_run(void) {
        cerr << __FILE__ << ": real_run." << endl;
 #endif // DEBUG
        while (!stop) {
        cerr << __FILE__ << ": real_run." << endl;
 #endif // DEBUG
        while (!stop) {
+               simulator_mutex.lock();
                simulator.simulate();
                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());
                }
                for (TransmitterList::iterator i = transmissions.begin();
                                i != transmissions.end(); i++) {
                        (*i)->send(simulator.get_state_as_xml());
                }
+               transmissions_mutex.unlock();
                Glib::usleep(1000000);
        }
 }
                Glib::usleep(1000000);
        }
 }
@@ -119,6 +122,11 @@ bool Plant::transmission_stop(const string& host,
        return false; // No la encontró.
 }
 
        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 {
 const string Plant::get_xml(void) const {
        ostringstream oss;
        try {