good approach? (QAbstractItemModel with a read-write lock)
(note : i have little experience with multithreading and thread safety)
i needed my item model to interact with objects from different threads, so i added a QReadWriteLock to the model (specified it mutable), and lock from any call that either read or writes (made sure that a the model doesn't deadlock itself logic-wise)
is this a good approach, or am i planting landmines?
Re: good approach? (QAbstractItemModel with a read-write lock)
Hi, I think it's a good approach.
And... I think than using QReadLocker and QWriteLocker is more safe than QReadWriteLock::lock(), QReadWriteLock::unlock() =)
Re: good approach? (QAbstractItemModel with a read-write lock)
It is not a very good approach however it shouldn't blow up in your face. Please specify how are you accessing the model from different threads and why.