X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/751302dd67ffdeb0dfe72c4d2a7a2d58303cf5f3..0d72fb12dc9a570be45e2f25320ac49f604c3ed2:/Server/src/runnable.cpp?ds=sidebyside diff --git a/Server/src/runnable.cpp b/Server/src/runnable.cpp index cb3ba6f..68296e4 100644 --- a/Server/src/runnable.cpp +++ b/Server/src/runnable.cpp @@ -26,38 +26,44 @@ // #include "plaqui/server/runnable.h" -#include +#include #include #ifdef DEBUG # include #endif // DEBUG -PlaQui::Server::Runnable::~Runnable(void) { +using namespace std; + +namespace PlaQui { + +namespace Server { + +Runnable::~Runnable(void) { #ifdef DEBUG - std::cerr << __FILE__ << ": destructor(this = " << this << ")" - << std::endl; + cerr << __FILE__ << ": destructor(this = " << this << ")" + << endl; #endif // DEBUG } -PlaQui::Server::Runnable::Runnable(void): thread(0), stop(false) { +Runnable::Runnable(void): thread(0), stop(false) { #ifdef DEBUG - std::cerr << __FILE__ << ": constructor." << std::endl; + cerr << __FILE__ << ": constructor." << endl; #endif // DEBUG } -void PlaQui::Server::Runnable::static_run(Runnable* runner) { +void Runnable::static_run(Runnable* runner) { #ifdef DEBUG - std::cerr << __FILE__ << ": static_run(runner = " << runner << ")" - << std::endl; + cerr << __FILE__ << ": static_run(runner = " << runner << ")" + << endl; #endif // DEBUG runner->real_run(); - runner->signal_finished().emit(); + runner->finished(); delete runner; } -void PlaQui::Server::Runnable::run(bool detach) { +void Runnable::run(bool detach) { #ifdef DEBUG - std::cerr << __FILE__ << ": run(detach = " << detach << ")" << std::endl; + cerr << __FILE__ << ": run(detach = " << detach << ")" << endl; #endif // DEBUG // Si vamos a correr la tarea en un thread. if (detach) { @@ -73,9 +79,9 @@ void PlaQui::Server::Runnable::run(bool detach) { } -void PlaQui::Server::Runnable::finish(bool attach) { +void Runnable::finish(bool attach) { #ifdef DEBUG - std::cerr << __FILE__ << ": finish(attach = " << attach << ")" << std::endl; + cerr << __FILE__ << ": finish(attach = " << attach << ")" << endl; #endif // DEBUG stop = true; if (attach) { @@ -83,8 +89,11 @@ 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; } +} // namespace Server + +} // namespace PlaQui +