HomeWildfire Games

Remove the Engine threading when using Atlas

Description

Remove the Engine threading when using Atlas

MacOS requires some UI-related API calls to happen on the main thread. There are several SDL functions that call UI-things, and those were, since #500 / r10299, in a separate thread.
This crashes on Catalina, instead of simply warning (see #5470).

It is not the first time we had such issues, as originally the Engine was on the main thread and AtlasUI on a separate thread.
That didn't work on MacOS, so the threading was inverted in #500 / r10299, with AtlasUI on the main thread and the Engine in another thread.
Unfortunately, this still wasn't enough.

This formally unthreads the engine, running it on a wxTimer, to avoid these issues.

Future work should focus on:

  • Further decoupling the simulation from the engine itself, as what Atlas really needs is a threaded simulation, not a threaded engine.
  • Making the simulation itself more threaded
  • Making it possible to do tasks asynchronously under Atlas.

Refs #500
Fixes #5470

Differential Revision: https://code.wildfiregames.com/D2752

Event Timeline

vladislavbelov added inline comments.
/ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp
72

Wrong CC naming.

/ps/trunk/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp
210

Wrong CC naming.

/ps/trunk/source/tools/atlas/GameInterface/MessagePasserImpl.cpp
72–75

Why duplication?