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 Updated to NodeBB v4.3 + New Features

Cleanup code with Linux

Scheduled Pinned Locked Moved Unsolved General and Desktop
linuxcleanupsigactionsigint
3 Posts 2 Posters 1.6k Views 1 Watching
  • 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 16 Nov 2015, 08:14 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
    • J Offline
      J Offline
      JKSH
      Moderators
      wrote on 16 Nov 2015, 08:31 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 18 Nov 2015, 12:11 last edited by
        #3

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

        1 Reply Last reply
        0

        1/3

        16 Nov 2015, 08:14

        • Login

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