[mythtv-commits] mythtv/master commit: f4ba7827e by Daniel Kristjansson (daniel-kristjansson)
MythTV
noreply at mythtv.org
Tue Aug 9 14:18:24 UTC 2011
Author: Daniel Kristjansson <danielk at cuymedia.net>
Change Date: 2011-08-09T07:09:40-07:00
Push Date: 2011/08/09 07:18:16 -0700
Repository: mythtv
Branch: master
New Revision: f4ba7827e165672ed8c0c901b50243443f5f203d
Changeset: https://github.com/MythTV/mythtv/commit/f4ba7827e
Log:
Fixes #9972. Apply the construct on first use idiom to two previously staticaly initialized threads.
C++ initializes statics in a strict order within a compilation unit, but across compilation units the order is random.
This is a problem when you statically initialize an MThread because you may initialize it before the static MThread
debugging variables are statically initialized. i.e. mythsocket.o or logging.o may be initialized before mthread.o
It's possible to work around this using compiler attributes, but a cleaner solution is to use the construct-on-first-use idiom as it will work correctly on all systems.
This also adds a warning to the mthread.h doxygen doct to not to statically initialize threads.
Modified:
mythtv/libs/libmythbase/logging.cpp
mythtv/libs/libmythbase/mthread.h
mythtv/libs/libmythbase/mythsocket.cpp
mythtv/libs/libmythbase/mythsocket.h
mythtv/libs/libmythbase/mythsocketthread.cpp
More information about the mythtv-commits
mailing list