document which thread each call is coming from

develop
Myk Taylor 2023-04-13 00:40:10 -07:00
parent 6c577fbe26
commit 48c3a2c987
No known key found for this signature in database
1 changed files with 9 additions and 7 deletions

@ -1,33 +1,35 @@
#include "Core.h" #include "Core.h"
#include "Export.h" #include "Export.h"
// called before main event loop starts // called from the main thread before the simulation thread is started
// and the main event loop is initiated
DFhackCExport void dfhooks_init() { DFhackCExport void dfhooks_init() {
// TODO: initialize things we need to do while still in the main thread // TODO: initialize things we need to do while still in the main thread
} }
// called after main event loops exits // called from the main thread after the main event loops exits
DFhackCExport void dfhooks_shutdown() { DFhackCExport void dfhooks_shutdown() {
DFHack::Core::getInstance().Shutdown(); DFHack::Core::getInstance().Shutdown();
} }
// called in the main event loop // called from the simulation thread in the main event loop
DFhackCExport void dfhooks_update() { DFhackCExport void dfhooks_update() {
DFHack::Core::getInstance().Update(); DFHack::Core::getInstance().Update();
} }
// called just before adding the macro recording/playback overlay // called from the simulation thread just before adding the macro
// recording/playback overlay
DFhackCExport void dfhooks_prerender() { DFhackCExport void dfhooks_prerender() {
// TODO: render overlay widgets that are not attached to a viewscreen // TODO: render overlay widgets that are not attached to a viewscreen
} }
// called for each SDL event, if true is returned, then the event has been // called from the main thread for each SDL event. if true is returned, then
// consumed and further processing shouldn't happen // the event has been consumed and further processing shouldn't happen
DFhackCExport bool dfhooks_sdl_event(SDL::Event* event) { DFhackCExport bool dfhooks_sdl_event(SDL::Event* event) {
return DFHack::Core::getInstance().DFH_SDL_Event(event); return DFHack::Core::getInstance().DFH_SDL_Event(event);
} }
// called for each utf-8 char read from the ncurses input // called from the main thread for each utf-8 char read from the ncurses input
// key is positive for ncurses keys and negative for everything else // key is positive for ncurses keys and negative for everything else
// if true is returned, then the event has been consumed and further processing // if true is returned, then the event has been consumed and further processing
// shouldn't happen // shouldn't happen