Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Cleanup code with Linux
Forum Update on Monday, May 27th 2025

Cleanup code with Linux

Scheduled Pinned Locked Moved Unsolved General and Desktop
linuxcleanupsigactionsigint
3 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qtacc32
    wrote on last edited by
    #1

    Hello,

    I want to do proper cleanup before the linux application is closed by the user (SIGINT etc.).
    So I have to catch these linux signals because Qt's event loop (QCoreApplication::exec) doesn't react on them.

    I wanted to simply call QCoreApplication::quit() in the signal handler, but stop! quit() isn't documented as reentrant.
    It works but it's not correct I guess because what if Qt is checking the event queue while SIGINT arrives and calls quit() which manipulates that event queue... race condition?

    Thank you!

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi @qtacc32, this might help: http://doc.qt.io/qt-5/unix-signals.html

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      1
      • Q Offline
        Q Offline
        qtacc32
        wrote on last edited by
        #3

        Ohh, I must have overlooked that.
        It seems to be the solution, thanks!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved