https://invisible-island.net/xterm/xtoolkit/
XtAppSetExitFlag, XtAppGetExitFlag - thread support functions
#include <X11/Intrinsic.h> void XtAppSetExitFlag(XtAppContext app_context); Boolean XtAppGetExitFlag(XtAppContext app_context);
app_context Specifies the application context.
To indicate that an application context should exit, use XtAppSetExit- Flag. To test the exit status of an application context, use XtAppGetExit- Flag.
X Toolkit Intrinsics – C Language Interface Xlib - C Language X Interface X Version 11 libXt 1.1.5.2 XtAppSetExitFlag(3)