|
|
"Caleb Tennis" <caleb@xxxxxxxxxx> wrote:
> > I'm confused about whether multithreading is possible when using the SQL
> > module. The documentation seems to suggest it is possible (subject to
>
> Yeah, it works fine here. Just make sure to QMutex your database calls
> across the threads so that you're not trying to access the database at the
> same time via the same connection in two different threads.
>
> Don't forget too that long queries can slow down the event loop, so it may
> make more sense to try and move all of your database activity out of the
> GUI thread.
I don't have a GUI to worry about as it's a server application which spawns
a new thread for each client. What I'd like to avoid is a long query in one
thread holding up queries in the other threads, hence I want to specifically
allow concurrent access to the database. Each thread has its own connection
obtained from QSqlDatabase::addDatabase, however the non-reentrancy of
QSqlDatabase would seem to suggest that only one of these connections can be
used at any one time, hence my problem.
--
Mark Sawle
Intellegit Ltd.
--
List archive and information: http://lists.trolltech.com/qt-interest/
|
|