Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Resource management
Qt 6.11 is out! See what's new in the release blog

Resource management

Scheduled Pinned Locked Moved C++ Gurus
3 Posts 2 Posters 1.5k 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.
  • P Offline
    P Offline
    pixaeiro
    wrote on last edited by
    #1

    Hello,

    Does anybody know if there is a good library or document about how to manage resources in C++?

    I am developing something similar to how DirectX manages its resources, where you Lock the resource to get access to it, read or write it, and then you Release the resource.

    What I am trying to do is to have something like LockWrite and LockRead. This way the owner of the resource can LockWrite to it, write, and then ReleaseWrite it. Clients will do LockRead, read, and then ReleaseRead.

    Many clients can read the resource at the same time, but to write to the resource the owner has to wait that nobody is reading the resource.

    Does anybody know where to find some samples similar to this?

    Thank you!

    pixaeiro
    http://www.pixaflux.com
    Parametric Image Compositing

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      From a Qt point of your are you thinking about something like:
      "QMutex":http://doc.qt.io/qt-5/qmutex.html
      "QMutexLocker":http://doc.qt.io/qt-5/qmutexlocker.html
      "QReadWriteLock":http://doc.qt.io/qt-5/qreadwritelock.html
      "QSemaphore":http://doc.qt.io/qt-5/qsemaphore.html
      and friends ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pixaeiro
        wrote on last edited by
        #3

        Yes, QReadWriteLock seems to be exactly what I need.
        Thank you SGaist!

        pixaeiro
        http://www.pixaflux.com
        Parametric Image Compositing

        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