00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __runner_h
00010 #define __runner_h
00011
00012 #include <eoFunctor.h>
00013
00014 #include "communicable.h"
00015 #include "thread.h"
00016
00017 typedef unsigned RUNNER_ID;
00018
00019 class Runner : public Communicable, public Thread {
00020
00021 public :
00022
00023 Runner ();
00024
00025 void start ();
00026
00027 void waitStarting ();
00028
00029 bool isLocal ();
00030
00031 void terminate ();
00032
00033 virtual void run () = 0;
00034
00035 RUNNER_ID getID ();
00036
00037 void packTermination ();
00038
00039 void notifySendingTermination ();
00040
00041 private :
00042
00043 sem_t sem_start;
00044
00045 unsigned id;
00046 };
00047
00048 extern bool atLeastOneActiveRunner ();
00049
00050 extern void unpackTerminationOfRunner ();
00051
00052 extern Runner * getRunner (RUNNER_ID __key);
00053
00054 extern void startRunners ();
00055
00056 extern void joinRunners ();
00057
00058 #endif