phoenix-firestorm/indra/llcommon
Nat Goodspeed a9cf349de4 DRTVWR-494: Improve thread safety of LLSingleton machinery.
Remove warnings about LLSingleton not being thread-safe because, at this point,
we have devoted considerable effort to trying to make it thread-safe.

Add LLSingleton<T>::Locker, a nested class which both provides a function-
static mutex and a scoped lock that uses it. Instantiating Locker, which has a
nullary constructor, replaces the somewhat cumbersome idiom of declaring a
std::unique_lock<std::recursive_mutex> lk(getMutex);

This eliminates (or rather, absorbs) the typedefs and getMutex() method from
LLParamSingleton. Replace explicit std::unique_lock declarations in
LLParamSingleton methods with Locker declarations.

Remove LLSingleton<T>::SingletonInitializer nested struct. Instead of
getInstance() relying on function-static initialization to protect (only)
constructSingleton() calls, explicitly use a Locker instance to cover its
whole scope, and make the UNINITIALIZED case call constructSingleton().
Rearrange cases so that after constructSingleton(), control falls through to
the CONSTRUCTED case and the finishInitializing() call.

Use a Locker instance in other public-facing methods too: instanceExists(),
wasDeleted(), ~LLSingleton(). Make destructor protected so it can only be called
via deleteSingleton() (but must be accessible to subclasses for overrides).

Remove LLSingletonBase::get_master() and get_initializing(), which permitted
directly manipulating the master list and the initializing stack without any
locking mechanism. Replace with get_initializing_size().

Similarly, replace LLSingleton_manage_master::get_initializing() with
get_initializing_size(). Use in constructSingleton() in place of
get_initializing().size().

Remove LLSingletonBase::capture_dependency()'s list_t parameter, which
accepted the list returned by get_initializing(). Encapsulate that retrieval
within the scope of the new lock in capture_dependency().

Add LLSingleton_manage_master::capture_dependency(LLSingletonBase*, EInitState)
to forward (or not) a call to LLSingletonBase::capture_dependency(). Nullary
LLSingleton<T>::capture_dependency() calls new LLSingleton_manage_master method.

Equip LLSingletonBase::MasterList with a mutex of its own, separate from the
one donated by the LLSingleton machinery, to serialize use of MasterList data
members. Introduce MasterList::Lock nested class to lock the MasterList mutex
while providing a reference to the MasterList instance. Introduce subclasses
LockedMaster, which provides a reference to the actual mMaster master list
while holding the MasterList lock; and LockedInitializing, which does the same
for the initializing list. Make mMaster and get_initializing_() private so
that consuming code can *only* access those lists via LockedInitializing and
LockedMaster.

Make MasterList::cleanup_initializing_() private, with a LockedInitializing
public forwarding method. This avoids another call to MasterList::instance(),
and also mandates that the lock is currently held during every call.

Similarly, move LLSingletonBase::log_initializing() to a LockedInitializing
log() method.
(transplanted from dca0f16266c7bddedb51ae7d7dca468ba87060d5)
2019-11-23 22:18:45 -05:00
..
tests DRTVWR-494: Defend LLInstanceTracker against multi-thread usage. 2019-12-02 14:39:24 -05:00
CMakeLists.txt Merged in lindenlab/viewer-release 2019-03-01 02:24:00 +02:00
StackWalker.cpp
StackWalker.h
ctype_workaround.h
fix_macros.h
indra_constants.cpp [SL-1360] - fix no alpha on default bake textures. uploaded new pngs 2019-02-20 03:16:05 +05:30
indra_constants.h Merge 2019-05-10 12:22:29 -06:00
is_approx_equal_fraction.h
linden_common.h
llalignedarray.h
llallocator.cpp
llallocator.h
llallocator_heap_profile.cpp
llallocator_heap_profile.h
llapp.cpp
llapp.h SL-10291 Replace apr_atomic with standard C++11 functionality 2019-01-15 18:31:17 +02:00
llapr.cpp SL-10291 Replace apr_mutex with standard C++11 functionality 2019-01-14 22:04:44 +02:00
llapr.h SL-10291 Replace apr_atomic with standard C++11 functionality 2019-01-15 18:31:17 +02:00
llassettype.cpp MAINT-8803 Better UI handling of unrecognized inventory items 2018-08-01 17:41:34 +03:00
llassettype.h MAINT-8803 Better UI handling of unrecognized inventory items 2018-08-01 17:41:34 +03:00
llatomic.cpp SL-10291 Replace apr_atomic with standard C++11 functionality 2019-01-15 18:31:17 +02:00
llatomic.h SL-10291 Replace apr_atomic with standard C++11 functionality 2019-01-15 18:31:17 +02:00
llbase32.cpp
llbase32.h
llbase64.cpp
llbase64.h
llbitpack.cpp
llbitpack.h
llboost.h
llcallbacklist.cpp
llcallbacklist.h
llcallstack.cpp
llcallstack.h
llcleanup.cpp
llcleanup.h
llclickaction.h
llcommon.cpp
llcommon.h
llcommonutils.cpp
llcommonutils.h
llcoro_get_id.cpp
llcoro_get_id.h
llcoros.cpp
llcoros.h DRTVWR-474: Make login coroutine sync with updater process on failure. 2018-10-04 16:35:38 -04:00
llcrc.cpp
llcrc.h
llcriticaldamp.cpp
llcriticaldamp.h
lldate.cpp
lldate.h
lldeadmantimer.cpp
lldeadmantimer.h
lldefs.h
lldependencies.cpp
lldependencies.h
lldepthstack.h
lldictionary.cpp
lldictionary.h
lldoubledispatch.h
llendianswizzle.h
llerror.cpp Merged in lindenlab/viewer-release 2019-03-01 02:24:00 +02:00
llerror.h SL-967 simplify viewer log file field syntax 2018-08-29 16:43:45 -04:00
llerrorcontrol.h Automated merge with ssh://bitbucket.org/lindenlab/viewer-release 2018-11-14 16:17:36 -05:00
llerrorlegacy.h
llerrorthread.cpp
llerrorthread.h
llevent.cpp
llevent.h
lleventapi.cpp
lleventapi.h
lleventcoro.cpp
lleventcoro.h
lleventdispatcher.cpp
lleventdispatcher.h
lleventemitter.h
lleventfilter.cpp
lleventfilter.h
llevents.cpp DRTVWR-474: Make LLEventMailDrop pass all saved events to listener. 2018-09-27 14:57:03 -04:00
llevents.h Mac buildfix 2019-05-14 01:14:54 +03:00
lleventtimer.cpp DRTVWR-494: Defend LLInstanceTracker against multi-thread usage. 2019-12-02 14:39:24 -05:00
lleventtimer.h
llexception.cpp
llexception.h
llfasttimer.cpp DRTVWR-494: Defend LLInstanceTracker against multi-thread usage. 2019-12-02 14:39:24 -05:00
llfasttimer.h SL-11231 Unused code and wrong macro 2019-05-28 19:16:34 +03:00
llfile.cpp SL-10153: Review and rationalize fetching paths from environment. 2018-12-14 15:38:13 -05:00
llfile.h
llfindlocale.cpp
llfindlocale.h
llfixedbuffer.cpp SL-10291 Replace apr_mutex with standard C++11 functionality 2019-01-14 22:04:44 +02:00
llfixedbuffer.h
llformat.cpp
llformat.h
llframetimer.cpp
llframetimer.h
llhandle.h
llhash.h
llheartbeat.cpp
llheartbeat.h
llheteromap.cpp
llheteromap.h
llindexedvector.h
llinitdestroyclass.cpp
llinitdestroyclass.h
llinitparam.cpp
llinitparam.h DRTVWR-474: Do NOT autokill updater process on viewer termination. 2018-10-03 14:00:05 -04:00
llinstancetracker.cpp DRTVWR-494: Defend LLInstanceTracker against multi-thread usage. 2019-12-02 14:39:24 -05:00
llinstancetracker.h DRTVWR-494: Quiet VS warnings about its own <mutex> header. 2019-12-02 15:40:02 -05:00
llkeythrottle.h
llkeyusetracker.h
llleap.cpp DRTVWR-474: Do NOT autokill updater process on viewer termination. 2018-10-03 14:00:05 -04:00
llleap.h DRTVWR-474: Do NOT autokill updater process on viewer termination. 2018-10-03 14:00:05 -04:00
llleaplistener.cpp DRTVWR-494: Defend LLInstanceTracker against multi-thread usage. 2019-12-02 14:39:24 -05:00
llleaplistener.h
lllistenerwrapper.h
llliveappconfig.cpp
llliveappconfig.h
lllivefile.cpp
lllivefile.h
llmake.h
llmd5.cpp
llmd5.h
llmemory.cpp
llmemory.h SL-944 - disabled a not-very-useful assert that greatly slows the RWD build 2018-07-31 14:02:42 +01:00
llmemorystream.cpp
llmemorystream.h
llmetricperformancetester.cpp
llmetricperformancetester.h
llmetrics.cpp
llmetrics.h
llmortician.cpp SL-10908 Output class names we are clearing on startup 2019-05-27 17:32:53 +03:00
llmortician.h SL-10908 Output class names we are clearing on startup 2019-05-27 17:32:53 +03:00
llmutex.cpp SL-10291 Replace apr_atomic with standard C++11 functionality 2019-01-15 18:31:17 +02:00
llmutex.h SL-10291 Replace apr_mutex with standard C++11 functionality 2019-01-14 22:04:44 +02:00
llnametable.h
llpointer.h
llpounceable.h
llpredicate.cpp
llpredicate.h
llpreprocessor.h SL-10153: Introduce ll_convert, windows_message() templates. 2018-12-14 10:48:43 -05:00
llpriqueuemap.h
llprocess.cpp SL-10153: Introduce ll_convert, windows_message() templates. 2018-12-14 10:48:43 -05:00
llprocess.h
llprocessor.cpp SL-967 simplify viewer log file field syntax 2018-08-29 16:43:45 -04:00
llprocessor.h
llprocinfo.cpp
llprocinfo.h
llptrto.cpp
llptrto.h
llqueuedthread.cpp
llqueuedthread.h SL-10291 Replace apr_atomic with standard C++11 functionality 2019-01-15 18:31:17 +02:00
llrand.cpp
llrand.h
llrefcount.cpp SL-10291 cleanup-mutex 2019-01-17 01:53:27 +02:00
llrefcount.h SL-10291 cleanup-mutex 2019-01-17 01:53:27 +02:00
llregistry.h
llrun.cpp
llrun.h
llsafehandle.h
llsd.cpp
llsd.h
llsdjson.cpp
llsdjson.h
llsdparam.cpp
llsdparam.h
llsdserialize.cpp
llsdserialize.h
llsdserialize_xml.cpp
llsdserialize_xml.h
llsdutil.cpp
llsdutil.h
llsimplehash.h
llsingleton.cpp DRTVWR-494: Improve thread safety of LLSingleton machinery. 2019-11-23 22:18:45 -05:00
llsingleton.h DRTVWR-494: Improve thread safety of LLSingleton machinery. 2019-11-23 22:18:45 -05:00
llsmoothstep.h
llstacktrace.cpp
llstacktrace.h
llstatenums.h
llstaticstringtable.h
llstatsaccumulator.h
llstl.h
llstreamqueue.cpp
llstreamqueue.h
llstreamtools.cpp
llstreamtools.h
llstrider.h
llstring.cpp SL-10153: Fix previous commit for non-Windows systems. 2018-12-14 12:01:51 -05:00
llstring.h SL-10930 LLStringUtil pointlessly scan the string 2019-04-16 21:58:22 +03:00
llstringtable.cpp
llstringtable.h
llsys.cpp SL-9935 Include full win10 build number in Help > About Second Life and logs 2018-11-12 15:31:19 +02:00
llsys.h
llthread.cpp SL-10291 Replace apr thread with standard C++11 functionality 2019-01-15 22:27:28 +02:00
llthread.h SL-10291 Replace apr thread with standard C++11 functionality 2019-01-15 22:27:28 +02:00
llthreadlocalstorage.cpp DRTVWR-494: Defend LLInstanceTracker against multi-thread usage. 2019-12-02 14:39:24 -05:00
llthreadlocalstorage.h
llthreadsafequeue.cpp SL-10291 Replace apr thread with standard C++11 functionality 2019-01-15 22:27:28 +02:00
llthreadsafequeue.h SL-10291 Replace apr thread with standard C++11 functionality 2019-01-15 22:27:28 +02:00
lltimer.cpp
lltimer.h
lltrace.cpp
lltrace.h DRTVWR-494: Defend LLInstanceTracker against multi-thread usage. 2019-12-02 14:39:24 -05:00
lltraceaccumulators.cpp
lltraceaccumulators.h
lltracerecording.cpp
lltracerecording.h
lltracethreadrecorder.cpp DRTVWR-494: Defend LLInstanceTracker against multi-thread usage. 2019-12-02 14:39:24 -05:00
lltracethreadrecorder.h
lltreeiterators.h
llunits.h
llunittype.h
lluri.cpp SL-10924 Missed symbol 2019-04-13 14:42:38 +03:00
lluri.h SL-10924 Fix data escaping to accomodate CEF update 2019-04-11 20:29:50 +03:00
lluriparser.cpp
lluriparser.h
lluuid.cpp SL-10291 Replace apr_mutex with standard C++11 functionality 2019-01-14 22:04:44 +02:00
lluuid.h
llwin32headers.h
llwin32headerslean.h
llworkerthread.cpp SL-10291 Replace apr_mutex with standard C++11 functionality 2019-01-14 22:04:44 +02:00
llworkerthread.h SL-10291 Replace apr_atomic with standard C++11 functionality 2019-01-15 18:31:17 +02:00
stdtypes.h SL-10153: Introduce ll_convert, windows_message() templates. 2018-12-14 10:48:43 -05:00
string_table.h
stringize.h
timer.h
timing.cpp
u64.cpp
u64.h