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. QSharedMemory access without lock()?
Forum Updated to NodeBB v4.3 + New Features

QSharedMemory access without lock()?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 459 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.
  • T Offline
    T Offline
    Taytoo
    wrote on last edited by
    #1

    Can QSharedMemory be accessed by two or more processes simultaneously without calling lock(), as long as they respect write boundaries of the memory e.g. Allocated memory is 30KB, 1st process writes in 0-10KB, 2nd in 10-20KB, 3rd in 20-30KB? Same with read i.e. that they don't read an area while other is writing to it?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      According to the documentation it's a simple semaphore so yes.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2
      • T Offline
        T Offline
        Taytoo
        wrote on last edited by
        #3

        It should be safe on windows, not sure about how it's implemented on osx/linux - not really familiar with osx/linux shared memory api's either. That's why wondering whether osx api uses some underlying locking api?

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Taytoo said in QSharedMemory access without lock()?:

          That's why wondering whether osx api uses some underlying locking api?

          Look at the code, it's opensource.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          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