ComponentThread: Remove lambdas; use standard async pattern
We've finally cleaned this code up by removing these dirty lambdas. Next we do the Mind:: class sequences.
This commit is contained in:
@@ -54,11 +54,13 @@ public:
|
||||
typedef void (mainFn)(ComponentThread &self);
|
||||
static mainFn main, marionetteMain;
|
||||
|
||||
typedef std::function<void()> threadLifetimeMgmtOpCbFn;
|
||||
// Thread management methods
|
||||
void startThreadReq(std::function<void()> callback = nullptr);
|
||||
void exitThreadReq(std::function<void()> callback = nullptr);
|
||||
void pauseThreadReq(std::function<void()> callback = nullptr);
|
||||
void resumeThreadReq(std::function<void()> callback = nullptr);
|
||||
void startThreadReq(threadLifetimeMgmtOpCbFn callback);
|
||||
void exitThreadReq(threadLifetimeMgmtOpCbFn callback);
|
||||
void pauseThreadReq(threadLifetimeMgmtOpCbFn callback);
|
||||
void resumeThreadReq(threadLifetimeMgmtOpCbFn callback);
|
||||
|
||||
/**
|
||||
* JOLTs this thread to begin processing after global initialization.
|
||||
*
|
||||
@@ -66,7 +68,7 @@ public:
|
||||
* event loops and set up TLS vars after all global constructors have
|
||||
* completed. This prevents race conditions during system startup.
|
||||
*/
|
||||
void joltThreadReq(std::function<void()> callback = nullptr);
|
||||
void joltThreadReq(threadLifetimeMgmtOpCbFn callback);
|
||||
|
||||
// CPU management methods
|
||||
static int getAvailableCpuCount();
|
||||
@@ -82,8 +84,9 @@ public:
|
||||
N_ITEMS
|
||||
};
|
||||
|
||||
typedef std::function<void()> mindShutdownIndOpCbFn;
|
||||
// Intentionally doesn't take a callback.
|
||||
void exceptionInd(ComponentThread& thread);
|
||||
void exceptionInd(const std::shared_ptr<ComponentThread> &faultyThread);
|
||||
// Intentionally doesn't take a callback.
|
||||
void userShutdownInd();
|
||||
|
||||
@@ -124,6 +127,10 @@ public:
|
||||
|
||||
return threadNames[id];
|
||||
}
|
||||
|
||||
private:
|
||||
class ThreadLifetimeMgmtOp;
|
||||
class MindShutdownIndOp;
|
||||
};
|
||||
|
||||
namespace mrntt {
|
||||
|
||||
Reference in New Issue
Block a user