On segunda-feira, 15 de junho de 2020 03:58:12 PDT Bernhard Lindner wrote: > I wrote a logging application containing a signal handler that is registered > using std::signal(). The handler receives signals like SIGFPE, SIGSEGV, > etc. > > Now I would like to connect that handler to some Qt based logging code. > Unfortunately I could not find a portable solution to do that. > > Are there any functions in Qt that are considered async-handler-safe?
Absolutely none. Please restrict your use in the signal handler to only the functions listed here: https://man7.org/linux/man-pages/man7/signal-safety.7.html > I'm especially looking for a way to send a (queued) signal. Other portable > ways to wake the application from the event loop would be fine as well. The simplest solution for this is to write some from the signal handler information to a pipe. It can be just a single byte to wake up the event loop. Then the main Qt event loop will pick that up via QSocketNotifier and act accordingly. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel System Software Products _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest