smo::Mind instance now global; track & manage JOLT state in Mind
We moved the instance of smo::Mind to global scope. I suppose we'll only support one instance of Mind per SMO process at least for now. We now track the state of Mind threads' JOLT-waiting. This allows us to centralize the Mind thread shutdown logic. Mind::finalizeReq() now takes care of all Mind thread shutdown state logic by tracking whether Mind threads need to be JOLTed first before being told to exit.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <thread>
|
||||
#include <functional>
|
||||
|
||||
#include <director/director.h>
|
||||
#include <simulator/simulator.h>
|
||||
@@ -12,9 +13,11 @@ namespace smo {
|
||||
class Mind
|
||||
{
|
||||
public:
|
||||
Mind(void) : threadsHaveBeenJolted(false) {}
|
||||
|
||||
void initialize(void);
|
||||
void execute(void);
|
||||
void finalize(void);
|
||||
void finalizeReq(std::function<void()> callback);
|
||||
|
||||
public:
|
||||
std::thread directorThread;
|
||||
@@ -23,8 +26,13 @@ public:
|
||||
|
||||
director::Director director;
|
||||
simulator::Simulator canvas;
|
||||
|
||||
private:
|
||||
bool threadsHaveBeenJolted;
|
||||
};
|
||||
|
||||
extern Mind mind;
|
||||
|
||||
} // namespace smo
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user