From 48c3a2c98738dcf3f8b16c8d50de6904db96d970 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Thu, 13 Apr 2023 00:40:10 -0700 Subject: [PATCH] document which thread each call is coming from --- library/Hooks.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/library/Hooks.cpp b/library/Hooks.cpp index 13f8bd908..c241e4875 100644 --- a/library/Hooks.cpp +++ b/library/Hooks.cpp @@ -1,33 +1,35 @@ #include "Core.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() { // 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() { DFHack::Core::getInstance().Shutdown(); } -// called in the main event loop +// called from the simulation thread in the main event loop DFhackCExport void dfhooks_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() { // 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 -// consumed and further processing shouldn't happen +// called from the main thread for each SDL event. if true is returned, then +// the event has been consumed and further processing shouldn't happen DFhackCExport bool dfhooks_sdl_event(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 // if true is returned, then the event has been consumed and further processing // shouldn't happen