Commit Graph

40091 Commits (a9cf349de4fea24d0cc0ad659bde7327ec623005)

Author SHA1 Message Date
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
Nat Goodspeed b22c41c8c5 DRTVWR-494: Quiet VS warnings about its own <mutex> header. 2019-12-02 15:40:02 -05:00
Nat Goodspeed b2913b7cf1 DRTVWR-494: Defend LLInstanceTracker against multi-thread usage.
The previous implementation went to some effort to crash if anyone attempted
to create or destroy an LLInstanceTracker subclass instance during traversal.
That restriction is manageable within a single thread, but becomes unworkable
if it's possible that a given subclass might be used on more than one thread.

Remove LLInstanceTracker::instance_iter, beginInstances(), endInstances(),
also key_iter, beginKeys() and endKeys(). Instead, introduce key_snapshot()
and instance_snapshot(), the only means of iterating over LLInstanceTracker
instances. (These are intended to resemble functions, but in fact the current
implementation simply presents the classes.) Iterating over a captured
snapshot defends against container modifications during traversal. The term
'snapshot' reminds the coder that a new instance created during traversal will
not be considered. To defend against instance deletion during traversal, a
snapshot stores std::weak_ptrs which it lazily dereferences, skipping on the
fly any that have expired.

Dereferencing instance_snapshot::iterator gets you a reference rather than a
pointer. Because some use cases want to delete all existing instances, add an
instance_snapshot::deleteAll() method that extracts the pointer. Those cases
used to require explicitly copying instance pointers into a separate
container; instance_snapshot() now takes care of that. It remains the caller's
responsibility to ensure that all instances of that LLInstanceTracker subclass
were allocated on the heap.

Replace unkeyed static LLInstanceTracker::getInstance(T*) -- which returned
nullptr if that instance had been destroyed -- with new getWeak() method
returning std::weak_ptr<T>. Caller must detect expiration of that weak_ptr.

Adjust tests accordingly.

Use of std::weak_ptr to detect expired instances requires engaging
std::shared_ptr in the constructor. We now store shared_ptrs in the static
containers (std::map for keyed, std::set for unkeyed).

Make LLInstanceTrackerBase a template parameterized on the type of the static
data it manages. For that reason, hoist static data class declarations out of
the class definitions to an LLInstanceTrackerStuff namespace.

Remove the static atomic sIterationNestDepth and its methods incrementDepth(),
decrementDepth() and getDepth(), since they were used only to forbid creation
and destruction during traversal.

Add a std::mutex to static data. Introduce an internal LockStatic class that
locks the mutex while providing a pointer to static data, making that the only
way to access the static data.

The LLINSTANCETRACKER_DTOR_NOEXCEPT macro goes away because we no longer
expect ~LLInstanceTracker() to throw an exception in test programs.
That affects LLTrace::StatBase as well as LLInstanceTracker itself.

Adapt consumers to the new LLInstanceTracker API.
2019-12-02 14:39:24 -05:00
Nat Goodspeed 4cb6e9ee08 DRTVWR-494: Show copy-paste-friendly env vars and test command.
Moderately often I want to copy the (long) integration test program path from
build output and rerun the test program by hand. But typically we need
environment variables set as well so it can find its dynamic libraries. This
has resulted in my copying parts of several lines of build output, then
pasting to a command prompt, then hand-tweaking the pasted text so it makes
sense as a command.

Streamline run_build_test.py output so less hand-tweaking is needed.
2019-11-23 22:16:39 -05:00
Nat Goodspeed 78bdf57ad6 increment viewer version to 6.3.5 2019-11-11 16:39:40 -05:00
Nat Goodspeed 55a5a2f0a7 Added tag 6.3.4-release for changeset 4033b3f57e76 2019-11-11 16:39:38 -05:00
andreykproductengine b70168b12f Merged in viewer-release 2019-10-29 23:00:30 +02:00
Nat Goodspeed 197cb2654c increment viewer version to 6.3.4 2019-10-29 12:31:52 -04:00
Nat Goodspeed 94512b0a77 Added tag 6.3.3-release for changeset d9a4bd15e2c8 2019-10-29 12:31:52 -04:00
Oz Linden 80236bb657 merge 6.3.2-release 2019-10-16 09:07:50 -04:00
andreykproductengine af5c556270 Merge from viewer-release 2019-10-15 21:28:37 +03:00
Nat Goodspeed 33821bd599 increment viewer version to 6.3.3 2019-10-15 13:27:53 -04:00
Nat Goodspeed b26bdc8987 Added tag 6.3.2-release for changeset 07f5d5bc9fae 2019-10-15 13:27:53 -04:00
andreykproductengine bd42fd13b0 SL-11719 Fixed init of conversation log 2019-10-14 20:49:16 +03:00
maxim_productengine 5ce0d6268b SL-12093 FIXED [ordered shutdown] conversation.log erased at log in when all logs are set to be saved 2019-10-10 16:35:11 +03:00
Oz Linden d89130c32a rename SLVoice log file and rotate the way we do for SecondLife.log 2019-10-04 15:16:24 -04:00
Oz Linden 1cb5ec9023 upgrade SLVoice to 4.10.0000.32327.5fc3fe7c.531581 2019-10-04 11:12:38 -04:00
Oz Linden 7e494d402d experimental 4.10 win64 package 2019-10-01 13:08:55 -04:00
Oz Linden f7d6fa677c update to SLVoice build 4.9.0002.32137.3410b595.531271 2019-09-27 11:49:39 -04:00
Oz Linden 00d7698999 upgrade to SLVoice package after fix for ortp linking 2019-09-25 15:54:40 -04:00
Oz Linden da560ac644 VOICE-80: suppress output to console on Windows 2019-09-20 14:33:57 -04:00
Oz Linden c9bb783331 update to SLVoice version 4.9.0002.32137.3410b595.531025 2019-09-17 14:40:25 -04:00
andreykproductengine 0ea0b98084 DRTVWR-493 LLLogChat to singleton 2019-09-16 20:32:25 +03:00
AndreyL ProductEngine 2f7b606202 Backed out changeset: 8e228364f324 2019-09-14 05:14:24 +03:00
AndreyL ProductEngine 548d688adf Backed out changeset: b4182ee25942 2019-09-14 05:14:07 +03:00
AndreyL ProductEngine 28640c19e8 Backed out changeset: 4273d752fb17 2019-09-14 05:13:58 +03:00
AndreyL ProductEngine ddbe9583ff Backed out changeset: a6398f90389a 2019-09-14 05:13:53 +03:00
AndreyL ProductEngine a07b64d30e Backed out changeset: 4a7dac768fae 2019-09-14 05:13:45 +03:00
AndreyL ProductEngine 423a9645e0 Backed out changeset: 20da15768791 2019-09-14 05:13:35 +03:00
AndreyL ProductEngine a100d62783 Backed out changeset: 8da237b54852 2019-09-14 05:13:27 +03:00
AndreyL ProductEngine 11390ad8ed Backed out changeset: 122dc88276c7 2019-09-14 05:13:19 +03:00
AndreyL ProductEngine 1b2579eca2 SL-11536 Backed out CEF update (changeset: c246ab81b298) 2019-09-14 02:28:34 +03:00
Oz Linden 1ed2cfaaf6 correct Mac SLVoice executable name 2019-09-13 15:21:47 -04:00
Oz Linden eccc8f6721 update Mac slvoice build 2019-09-13 09:43:28 -04:00
AndreyL ProductEngine 535aad96af Downstream merge from lindenlab/viewer-lynx 2019-09-10 23:17:02 +03:00
andreykproductengine 37eb735ba7 Merged in lindenlab/viewer-release 2019-09-10 20:30:25 +03:00
Nat Goodspeed e241670694 increment viewer version to 6.3.2 2019-09-10 11:40:40 -04:00
Nat Goodspeed 4798dea988 Added tag 6.3.1-release for changeset ece699718f16 2019-09-10 11:40:39 -04:00
Oz Linden b74f698caa handle slvoice executable separately from the vivox libraries, and update mac slvoice package 2019-09-06 11:51:36 -04:00
AndreyL ProductEngine 05f1e3e713 Merged in lindenlab/viewer-lynx 2019-09-05 21:53:24 +03:00
andreykproductengine fe0b881acc SL-11718 Another exit crash 2019-09-05 15:13:56 +03:00
andreykproductengine e1451bb1d1 DRTVWR-493 Do not recreate proxy only to destroy it 2019-09-04 20:56:45 +03:00
andreykproductengine 27d391b2bb SL-11868 Fix cache init after purge 2019-09-04 19:20:52 +03:00
andreykproductengine a8bc48b334 SL-11866 [D493] Some startup elements can be executed twice, added protections 2019-09-04 17:30:50 +03:00
andreykproductengine 05dee4c10b SL-11865 Fixed weird existance check 2019-09-04 16:32:54 +03:00
AndreyL ProductEngine e8194e6aba SL-11856 Backed out SL-11012
changeset: 0d43d9754b79
2019-09-03 00:25:07 +03:00
andreykproductengine e439f0366f Merge from lindenlab/viewer-release 2019-08-29 15:43:02 +03:00
AndreyL ProductEngine 1aedd96cd1 Merged in lindenlab/viewer-release 2019-08-26 22:21:30 +03:00
Nat Goodspeed 5986bf4826 increment viewer version to 6.3.1 2019-08-26 14:55:20 -04:00
Nat Goodspeed 3208ce1b7a Added tag 6.3.0-release for changeset 9777aec6dc4a 2019-08-26 14:55:19 -04:00