From 29158da41e7943ea8019efdbff70c994fb1c73e9 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 1 Feb 2015 18:07:20 +0100 Subject: Begin work on worker thread --- problem.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'problem.hpp') diff --git a/problem.hpp b/problem.hpp index 685e1df..8851fa2 100644 --- a/problem.hpp +++ b/problem.hpp @@ -2,6 +2,7 @@ #include #include +#include #include "geom.hpp" @@ -87,18 +88,35 @@ struct solver_internal { // represents a graph of randomly chosen positions and simple solutions between them std::vector pts; std::map > paths; + + void initialize(const problem &p); + solution try_find_solution(); + void step(const problem &p); }; class solver { // mutex-protected asynchronous structure private: + + sf::Mutex _d_lock; solver_internal _d; + problem _p; + + bool _please_stop; + bool _running; + bool _done; + solution _s; + + sf::Thread _worker; public: solver(); void start(const problem &p); + + void run(); // worker thread + bool finished(); solution get_solution(); -- cgit v1.2.3