X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/b92547a5de3a3fb4f14a2bea4a4e776b8da3cb5c..bb95c06ba5fa63ab90ee148ab8a6e009226a53cf:/Server/src/runnable.cpp diff --git a/Server/src/runnable.cpp b/Server/src/runnable.cpp index 0439ca0..d9d5048 100644 --- a/Server/src/runnable.cpp +++ b/Server/src/runnable.cpp @@ -26,7 +26,7 @@ // #include "plaqui/server/runnable.h" -#include +#include #include #ifdef DEBUG # include @@ -40,30 +40,35 @@ namespace Server { Runnable::~Runnable(void) { #ifdef DEBUG - cerr << __FILE__ << ": destructor(this = " << this << ")" + cerr << __FILE__ << "(" << __LINE__ << ")" + << ": destructor(this = " << this << ")" << endl; #endif // DEBUG } Runnable::Runnable(void): thread(0), stop(false) { #ifdef DEBUG - cerr << __FILE__ << ": constructor." << endl; + cerr << __FILE__ << "(" << __LINE__ << ")" + << ": constructor." << endl; #endif // DEBUG } void Runnable::static_run(Runnable* runner) { #ifdef DEBUG - cerr << __FILE__ << ": static_run(runner = " << runner << ")" + cerr << __FILE__ << "(" << __LINE__ << ")" + << ": static_run(runner = " << runner << ")" << endl; #endif // DEBUG runner->real_run(); - runner->signal_finished().emit(); + runner->finished(); + //runner->thread->join(); delete runner; } void Runnable::run(bool detach) { #ifdef DEBUG - cerr << __FILE__ << ": run(detach = " << detach << ")" << endl; + cerr << __FILE__ << "(" << __LINE__ << ")" + << ": run(detach = " << detach << ")" << endl; #endif // DEBUG // Si vamos a correr la tarea en un thread. if (detach) { @@ -71,7 +76,7 @@ void Runnable::run(bool detach) { // finalizar, pasandole el puntero al objeto. thread = Glib::Thread::create( SigC::bind(SigC::slot(&Runnable::static_run), this), - true); + true);//false); // Si no corremos la tarea normalmente. } else { real_run(); @@ -81,7 +86,8 @@ void Runnable::run(bool detach) { void Runnable::finish(bool attach) { #ifdef DEBUG - cerr << __FILE__ << ": finish(attach = " << attach << ")" << endl; + cerr << __FILE__ << "(" << __LINE__ << ")" + << ": finish(attach = " << attach << ")" << endl; #endif // DEBUG stop = true; if (attach) { @@ -93,6 +99,10 @@ Runnable::SignalFinished& Runnable::signal_finished(void) { return finished; } +Runnable::SignalError& Runnable::signal_error(void) { + return error; +} + } // namespace Server } // namespace PlaQui