]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Server/src/runnable.cpp
Scripts de configuracion a nivel global.
[z.facultad/75.42/plaqui.git] / Server / src / runnable.cpp
index cb3ba6fc84f1d14c1fee71ead30f98eadd4eef43..d9d5048ecbacf0dea076a3c43ab22251e7c317dc 100644 (file)
 //
 
 #include "plaqui/server/runnable.h"
 //
 
 #include "plaqui/server/runnable.h"
-#include <sigc++/class_slot.h>
+#include <sigc++/slot.h>
 #include <glibmm/thread.h>
 #ifdef DEBUG
 #      include <iostream>
 #endif // DEBUG
 
 #include <glibmm/thread.h>
 #ifdef DEBUG
 #      include <iostream>
 #endif // DEBUG
 
-PlaQui::Server::Runnable::~Runnable(void) {
+using namespace std;
+
+namespace PlaQui {
+
+namespace Server {
+
+Runnable::~Runnable(void) {
 #ifdef DEBUG
 #ifdef DEBUG
-       std::cerr << __FILE__ << ": destructor(this = " << this << ")"
-               << std::endl;
+       cerr << __FILE__ << "(" << __LINE__ << ")"
+               << ": destructor(this = " << this << ")"
+               << endl;
 #endif // DEBUG
 }
 
 #endif // DEBUG
 }
 
-PlaQui::Server::Runnable::Runnable(void): thread(0), stop(false) {
+Runnable::Runnable(void): thread(0), stop(false) {
 #ifdef DEBUG
 #ifdef DEBUG
-       std::cerr << __FILE__ << ": constructor." << std::endl;
+       cerr << __FILE__ << "(" << __LINE__ << ")"
+               << ": constructor." << endl;
 #endif // DEBUG
 }
 
 #endif // DEBUG
 }
 
-void PlaQui::Server::Runnable::static_run(Runnable* runner) {
+void Runnable::static_run(Runnable* runner) {
 #ifdef DEBUG
 #ifdef DEBUG
-       std::cerr << __FILE__ << ": static_run(runner = " << runner << ")"
-               << std::endl;
+       cerr << __FILE__ << "(" << __LINE__ << ")"
+               << ": static_run(runner = " << runner << ")"
+               << endl;
 #endif // DEBUG
        runner->real_run();
 #endif // DEBUG
        runner->real_run();
-       runner->signal_finished().emit();
+       runner->finished();
+       //runner->thread->join();
        delete runner;
 }
 
        delete runner;
 }
 
-void PlaQui::Server::Runnable::run(bool detach) {
+void Runnable::run(bool detach) {
 #ifdef DEBUG
 #ifdef DEBUG
-       std::cerr << __FILE__ << ": run(detach = " << detach << ")" << std::endl;
+       cerr << __FILE__ << "(" << __LINE__ << ")"
+               << ": run(detach = " << detach << ")" << endl;
 #endif // DEBUG
        // Si vamos a correr la tarea en un thread.
        if (detach) {
 #endif // DEBUG
        // Si vamos a correr la tarea en un thread.
        if (detach) {
@@ -65,7 +76,7 @@ void PlaQui::Server::Runnable::run(bool detach) {
                // finalizar, pasandole el puntero al objeto.
                thread = Glib::Thread::create(
                                SigC::bind<Runnable*>(SigC::slot(&Runnable::static_run), this),
                // finalizar, pasandole el puntero al objeto.
                thread = Glib::Thread::create(
                                SigC::bind<Runnable*>(SigC::slot(&Runnable::static_run), this),
-                               true);
+                               true);//false);
        // Si no corremos la tarea normalmente.
        } else {
                real_run();
        // Si no corremos la tarea normalmente.
        } else {
                real_run();
@@ -73,9 +84,10 @@ void PlaQui::Server::Runnable::run(bool detach) {
                
 }
 
                
 }
 
-void PlaQui::Server::Runnable::finish(bool attach) {
+void Runnable::finish(bool attach) {
 #ifdef DEBUG
 #ifdef DEBUG
-       std::cerr << __FILE__ << ": finish(attach = " << attach << ")" << std::endl;
+       cerr << __FILE__ << "(" << __LINE__ << ")"
+               << ": finish(attach = " << attach << ")" << endl;
 #endif // DEBUG
        stop = true;
        if (attach) {
 #endif // DEBUG
        stop = true;
        if (attach) {
@@ -83,8 +95,15 @@ void PlaQui::Server::Runnable::finish(bool attach) {
        }
 }
 
        }
 }
 
-PlaQui::Server::Runnable::SignalFinished&
-PlaQui::Server::Runnable::signal_finished(void) {
+Runnable::SignalFinished& Runnable::signal_finished(void) {
        return finished;
 }
 
        return finished;
 }
 
+Runnable::SignalError& Runnable::signal_error(void) {
+       return error;
+}
+
+} // namespace Server
+
+} // namespace PlaQui
+