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?
From a Qt point of your are you thinking about something like:
and friends ?
Yes, QReadWriteLock seems to be exactly what I need.
Thank you SGaist!