]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Server/src/runnable.h
- Muchas pequeñas correcciones.
[z.facultad/75.42/plaqui.git] / Server / src / runnable.h
index 04cb094fc57c58aad8d3dbfc217883a813913a86..39a221f26a684bc1569c6930a9529b42d6f92f11 100644 (file)
 #ifndef PLAQUI_RUNNABLE_H
 #define PLAQUI_RUNNABLE_H
 
+#include <glibmm/thread.h>
+
 namespace Plaqui {
 
        /// ealizauna tarea (generalmente en un thread).
        class Runnable {
 
+               private:
+                       // Thread en el cual correr la tarea.
+                       Glib::Thread* thread;
+
+               protected:
+
+                       /// Realiza la terea.
+                       virtual void real_run(void) = 0;
+
                public:
 
-                       /// Realiza la tarea.
-                       virtual void run(void) = 0;
+                       /**
+                        * Destructor.
+                        */
+                       virtual ~Runnable(void) {}
+
+                       /**
+                        * Constructor.
+                        */
+                       Runnable(void);
+
+                       /**
+                        * Comienza la tares.
+                        *
+                        * \param detach Si es true se corre en un thread propio. Si no no
+                        *                               retorna hasta que finaliza.
+                        */
+                       virtual void run(bool detach = true);
 
        };