Commit Graph

12 Commits

Author SHA1 Message Date
hayodea 2c891bd2f3 Mrntt: Re-add exceptionInd
This now ensures that finalizeReq is indeed called from mrntt,
since exception-experiencing threads will post an exceptionInd
to mrntt, which will then call finalizeReq.
2025-11-23 03:27:18 -04:00
hayodea 56367402d7 Move intrinEventInd()s from MarionetteComponent=>Director 2025-10-21 19:38:49 -04:00
hayodea d1b99852a8 Move MarionetteComponent out of component.h=>marionette.h 2025-10-21 19:38:49 -04:00
latentprion edd223b083 Remove unnecessary componentThread.h #includes
Since componentThread #includes boost::asio components, removing
it should improve compile times.
2025-10-16 02:15:16 -04:00
hayodea b768739b96 CompThr: Delete shutdownInd & exceptionInd
We no longer need them because we now have
mrntt::mrntt.finalizeReq(), which does a more holistic job of
shutting down Marionette (and thus, ultimately, Salmanoff).
2025-09-15 13:43:11 -04:00
hayodea 91ccd16b33 Add Mrntt component; init globalMind in mrntt.initializeReq
This makes the initialization sequence much cleaner and conceptually
well encapsulated.

We also now dynamically allocate the Mind objects. They're allocated
dynamically by Mrntt inside of initializeReq. This means that we no
longer have to worry about jolting and cleaning up the running threads
of global mind object even when we never explicitly called
Mind.initializeReq.

Along with other conceptual improvements to our abstractions, this
patch also gets us to a real "end of program initialization" point
for the first time.
2025-09-14 22:17:19 -04:00
hayodea da0ef64f62 Split CompThread=>MindThr+MrnttThr; alloc globalMind in mrnttMain
We now allocate globalMind locally inside of marionetteMain. Why?

Before now, we had an asymmetric threading situation where the
globalMind's threads were initialized at during global constructor
invocation and not on demand. This meant that we had to shut down
those threads even if we had never got to the point of calling
Mind::initializeReq.

This significantly complicated our shutdown sequence since we had
to factor in the lifetime of the std::thread objects inside of the
ComponentThreads which were inside of the globalMind object.

Now, if we hadn't called Mind::initializeReq, we don't have to
perform any Mind::finalizeReq or adjacent operations. Shutdown is
symmetrically mirrored against the operations we actually performed
during execution.

We introduced some complexity by splitting ComponentThreads into
two derivative types (MindThread and MarionetteThread) but I think
in the long term we'll be able to massage this split into a much
cleaner situation overall.
2025-09-14 11:07:05 -04:00
hayodea d26b791dd2 Handle SIGINT (CTL+C) by gracefully shutting down 2025-08-10 14:07:27 -04:00
hayodea 4fde28dad8 Mrntt: Call shutdownSalmanoff after exiting main loop
We moved initializeSalmanoff and shutdownSalmanoff into
salmanoff.cpp. Now we also invoke shutdownSalmanoff when exiting
to destroy subsystems and components gracefully.

This fixes the segfault that was thrown on every program exit
when xcbWindow had captured a window.
2025-07-30 10:09:25 -04:00
hayodea e276fcbdce Mrntt: use keepLooping after exception; Mind: split code from mrntt
Mrntt now has the event loop structure required to orderly shut itself
down when it itself generates an exception. We can now post a message
within the catch{} blocks for Mrntt's event loop, telling Mrntt
to shut down the Mind threads and then shut itself down.

We also split the code to initialize threads etc out of mrntt and
put it into the Mind:: namespace.
2025-07-30 09:09:38 -04:00
hayodea 36c79f3a2e Threading: run all code in PThreads, add JOLTing & exception bubbling
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.
2025-07-28 07:20:44 -04:00
hayodea 756571b9b4 Rename hcore=>smocore 2025-07-22 06:15:12 -04:00