diff options
Diffstat (limited to 'src/explicitsimulation.h')
-rw-r--r-- | src/explicitsimulation.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/explicitsimulation.h b/src/explicitsimulation.h index c2aeed9..7713c71 100644 --- a/src/explicitsimulation.h +++ b/src/explicitsimulation.h | |||
@@ -31,6 +31,9 @@ namespace Genetic | |||
31 | protected: | 31 | protected: |
32 | void updateFitness(); | 32 | void updateFitness(); |
33 | void setFitness( Genetic::PhenotypeId, double dFitness ); | 33 | void setFitness( Genetic::PhenotypeId, double dFitness ); |
34 | void workDone(); | ||
35 | void setRunning( bool b ); | ||
36 | bool isRunning(); | ||
34 | 37 | ||
35 | protected: | 38 | protected: |
36 | Population xPop; | 39 | Population xPop; |
@@ -49,8 +52,12 @@ namespace Genetic | |||
49 | PhenotypeId uMaxFitness; | 52 | PhenotypeId uMaxFitness; |
50 | 53 | ||
51 | Bu::Mutex mFitness; | 54 | Bu::Mutex mFitness; |
55 | Bu::Condition cWorkDone; | ||
52 | typedef Bu::SynchroQueue<Phenotype *> WorkQueue; | 56 | typedef Bu::SynchroQueue<Phenotype *> WorkQueue; |
53 | WorkQueue qWork; | 57 | WorkQueue qWork; |
58 | int iWorkDone; | ||
59 | bool bRunning; | ||
60 | Bu::Mutex mRunning; | ||
54 | 61 | ||
55 | class Processor : public Bu::Thread | 62 | class Processor : public Bu::Thread |
56 | { | 63 | { |
@@ -59,8 +66,6 @@ namespace Genetic | |||
59 | WorkQueue &rqWork, int iId ); | 66 | WorkQueue &rqWork, int iId ); |
60 | virtual ~Processor(); | 67 | virtual ~Processor(); |
61 | 68 | ||
62 | void setRunning( bool b ) { bRunning = b; } | ||
63 | |||
64 | protected: | 69 | protected: |
65 | virtual void run(); | 70 | virtual void run(); |
66 | 71 | ||
@@ -68,7 +73,6 @@ namespace Genetic | |||
68 | FitnessFunction *pFunc; | 73 | FitnessFunction *pFunc; |
69 | WorkQueue &rqWork; | 74 | WorkQueue &rqWork; |
70 | int iId; | 75 | int iId; |
71 | bool bRunning; | ||
72 | }; | 76 | }; |
73 | 77 | ||
74 | typedef Bu::List<Processor *> ProcessorList; | 78 | typedef Bu::List<Processor *> ProcessorList; |