QSharedMemory & QSystemSemaphore in Qt 7

From Qt Wiki
Jump to navigation Jump to search

Session Summary

What to do with QSharedMemory and QSystemSemaphore

Session Owners

Thiago Macieira


(Note: recreated from memory, note taker had a laptop trouble and the file wasn't saved) Add link to list archive

  • Thiago proposed deprecating now and moving to Qt6CoreCompat in Qt 7
    • No replacement class
    • Fabian has volunteered to investigate a replacement API before Qt 6.10
  • We'll add the deprecation markers now, with a trigger time in the future
    • Markers can be disabled with a macro (opt-out)
    • Current users shouldn't be affected – any issues that you have are ones you've always had
  • We'll link to a doc page explaining how to replace QSharedMemory
    • Use QFile::map for simple sharing of memory
    • Update as we learn more about use-cases
    • Ask for contact if use-case isn't taken into account
  • Known uses:
    • Biggest user of QSharedMemory is QtSingleApplication
      • Multiple different versions out there
      • Thiago volunteers to fix it
      • Peppe has reimplemented it from scratch, MIT-licensed, uses QLockFile+QtNetwork https://github.com/KDAB/KDSingleApplication
        • Avoids D-Bus as problematic on non-Linux
    • Use D-Bus on Linux, figure out what to do elsewhere
    • qtwayland has one use of QSharedMemory too
    • Sharing of large data sets to avoid serialisation
    • Shared images (qtdeclarative)
    • Androidtestrunner (single-application exclusion)
  • WINE implements Windows semantics on Unix; we could investigate
  • memfd is the "correct" solution on Linux and FreeBSD
    • similar enough to Windows semantics (disappears on last close)
    • not portable elsewhere