[Interest] QSqlDatabase and threads

Soroush R soroush.rabiei at gmail.com
Thu May 30 18:32:39 CEST 2013


In the case that your computation is massive, you may want to change your
concurrency design. You can add a writer thread to be the only one who
talks to database. Other threads write their manipulated data into a
mutex-guarded shared data structure (say a queue). Then the writer thread
can write data into database and free up the queue within time period, or
triggered by an external event.

This will improve performance only if the bottle-neck of time is in data
manipulation part of the application. Otherwise you may got no
improvements, but a considerable overhead (The time spent waiting behind
locks).

Cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130530/79fd2120/attachment.html>


More information about the Interest mailing list