Questions tagged [qreadwritelock]

The QReadWriteLock class, part of the Qt framework, provides read-write locking.

A read-write lock is a synchronization tool for protecting resources that can be accessed for reading and writing. This type of lock is useful if you want to allow multiple threads to have simultaneous read-only access, but as soon as one thread wants to write to the resource, all other threads must be blocked until the writing is complete.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

3 questions
3
votes
2 answers

In Qt, how do I query the state of a QMutex or a QReadWriteLock?

I'm using a QReadWriteLock in my application to guard access to a resource object. I'm using QReadLocks and QWriteLocks where I can, but sometimes I need a "long-lived" lock that crosses function boundaries. So sometimes I need to be able to query…
Lucas
  • 6,328
  • 8
  • 37
  • 49
1
vote
2 answers

QReadWriteLock Recursion mode not working

Under Linux qt 4.7.4 using gcc 4.4.3 the following code compiles fine and gives no runtime error. class TestThread: public QThread { private: QReadWriteLock mutex; public: bool mStop; TestThread():…
Martin
  • 4,738
  • 4
  • 28
  • 57
0
votes
1 answer

QReadWriteLock in accessors

I have a QList of MyClass. Appending and deleting items from list are rare and cotrolled by common list mutex. MyClass contains several substructures and personal QReadWriteLock: MyClass{ private: Substructure substructure; QReadWriteLock…
Syberia
  • 3
  • 3