36c79f3a2e
This commit significantly restructures the way we setup threading in SMO. We now don't use the CRT main() thread at all. It's only used as a mechanism to ensure that Marionette doesn't execute before global constructors have been executed. JOLTing: This is a simple ASIO post()ed message that makes each thread setup its thread-local data pointer to its own ComponentThread object, and then enter its main ASIO run() loop to await commands from Marionette. Exception bubbling: We now cleanly cause mind threads to report their exceptions to marionette, so that marionette can cleanly shut the mind down in an orderly fashion. Thread Control messaging API: A namespace of asynchronous messages to be post()ed to threads to control them. It enables us to pause and resume threads. This will be very useful for Marionette when we add the ability for it to suspend Salmanoff's running mind, inject new goals, inspect current state, etc; and then resume the mind's execution.
36 lines
526 B
C++
36 lines
526 B
C++
#ifndef _MARIONETTE_H
|
|
#define _MARIONETTE_H
|
|
|
|
#include <cstdint>
|
|
#include <atomic>
|
|
|
|
namespace smo {
|
|
namespace mrntt {
|
|
|
|
extern std::atomic<int> exitCode;
|
|
|
|
class Marionette
|
|
{
|
|
};
|
|
|
|
} // namespace mrntt
|
|
|
|
struct CrtCommandLineArgs
|
|
{
|
|
CrtCommandLineArgs(int argc, char *argv[], char *envp[])
|
|
: argc(argc), argv(argv), envp(envp)
|
|
{}
|
|
|
|
int argc;
|
|
char **argv;
|
|
char **envp;
|
|
|
|
static void set(int argc, char *argv[], char *envp[]);
|
|
};
|
|
|
|
int initializeSalmanoff(void);
|
|
|
|
} // namespace smo
|
|
|
|
#endif // _MARIONETTE_H
|