Revision 714479
Go back to digest for 23rd September 2007Bug Fixes in KDE Base
Found an impressive threading bugp
I used to lock QReadWriteLock twice for reading when creating an iterator. Once for the method itself with a QReadLocker and once for the iterator. Sometimes that would block.
The problem is that QReadWriteLock favors write locks over read locks, i.e. if a write lock is pending no read lock can be aquired, even a recursive one like the one I did would not get through.
Now for example listStatement would lock, then create the iterator, and then try to lock again. But if between the first and second lock a write operation started, the second read lock would block and wait for the write which in turn waits for the first read lock. -> dead lock.
Wow, it took me hours and hours to find that bug. But it really shows how tricky threaded programming is. :)
File Changes
- /branches/work/soprano2/backends
- /redland/redlandmodel.cpp
- /sesame2/sesame2model.cpp