Fix critical memory issue. Sent messages are launched asynchronously and only -std::future- results are stocked. This enable to check if a thread has completed its task (update methods in Model and Island return always true in that purpose) unlike the std:🧵:joinable method.
This commit is contained in:
parent
cdeb1929e2
commit
ca44e95add
5 changed files with 25 additions and 13 deletions
|
|
@ -33,6 +33,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr
|
|||
#include <queue>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include <future>
|
||||
#include <thread>
|
||||
|
||||
#include <bimap.h>
|
||||
|
|
@ -71,7 +72,7 @@ public:
|
|||
/**
|
||||
* Update the island model by adding population to send in the emigrants list.
|
||||
*/
|
||||
void update(eoPop<EOT> _data, AIsland<EOT>* _island);
|
||||
bool update(eoPop<EOT> _data, AIsland<EOT>* _island);
|
||||
|
||||
/**
|
||||
* Change topology
|
||||
|
|
@ -99,7 +100,7 @@ protected:
|
|||
Bimap<unsigned, AIsland<EOT>*> table;
|
||||
std::vector<std::pair<AIsland<EOT>*, bool>> islands;
|
||||
AbstractTopology& topo;
|
||||
std::vector<std::thread> sentMessages;
|
||||
std::vector<std::shared_future<bool>> sentMessages;
|
||||
std::mutex m;
|
||||
std::atomic<bool> running;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue