[mythtv-commits] mythtv/master commit: 42626b12b by Gavin Hurlbut (Beirdo)

MythTV noreply at mythtv.org
Tue Jun 21 06:08:33 UTC 2011

      Author:  Gavin Hurlbut <ghurlbut at mythtv.org>
 Change Date:  2011-06-20T23:08:09-07:00
   Push Date:  2011/06/20 23:08:26 -0700
  Repository:  mythtv
      Branch:  master
New Revision:  42626b12b52e27871b59e0c10b0cba10ec5c106f
   Changeset:  https://github.com/MythTV/mythtv/commit/42626b12b


Fix the my_thread_global_end() spew

It turns out that QSqlDatabase connections are totally not thread-safe.  A
connection must only be used in one thread, from the point where it's opened
and added right through until where it's closed and removed.  Our old code
depended solely on the ~MythContext dtor to close all the database connections,
so any connection not opened in the UI thread confused the Qt code, and mysql's
API waited for the wrong threads at shutdown.  This caused a 5s delay and an
ugly message like:

Error in my_thread_global_end(): 1 threads didn't exit

To fix this, the database logging thread now has its own database connection,
and threads that open connections are now explicitly closing them.

Additionally, the WriteDelayedSettings() code is forced to only run in the UI
thread.  Ideally, we need a centralized DB thread that handles all of the
connections, but that's a fairly large change, and can wait a bit longer



More information about the mythtv-commits mailing list