Commit Graph

34 Commits (a831237e29c650146b6870b568feddcda310ab29)

Author SHA1 Message Date
Beq f3aab4cecd [FIRE-33062] reduce verbosity when queue full situation occurs 2023-07-18 17:11:46 +01:00
Ansariel 82e80b7726 Revert "Revert changes for FIRE-32453 to try out the fix from LL"
This reverts commit c1fbf5e3c2.
2023-07-07 21:17:29 +02:00
Ansariel 1d28a79ec6 Merge branch 'master' of https://vcs.firestormviewer.org/phoenix-firestorm
# Conflicts:
#	doc/contributions.txt
#	indra/llcharacter/llkeyframemotion.cpp
#	indra/newview/llappviewer.cpp
#	indra/newview/llfilepicker.cpp
2023-05-18 13:43:48 +02:00
Ansariel c1fbf5e3c2 Revert changes for FIRE-32453 to try out the fix from LL 2023-03-22 16:38:27 +01:00
Ansariel 8d154eaa8c Merge branch 'contribute' of https://github.com/secondlife/viewer
# Conflicts:
#	indra/llappearance/llavatarappearance.cpp
#	indra/llappearance/lldriverparam.cpp
#	indra/llappearance/llwearable.cpp
#	indra/llcommon/llerror.cpp
#	indra/llcommon/llqueuedthread.cpp
#	indra/llcommon/llsdserialize.h
#	indra/llcommon/llthreadsafequeue.h
#	indra/newview/app_settings/settings.xml
#	indra/newview/llpathfindingnavmesh.cpp
#	indra/newview/llviewerassetstorage.cpp
#	indra/newview/llviewerdisplay.cpp
#	indra/newview/skins/default/xui/de/floater_flickr.xml
#	indra/newview/skins/default/xui/de/panel_flickr_photo.xml
#	indra/newview/skins/default/xui/en/floater_about_land.xml
#	indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml
#	indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml
#	indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml
#	indra/newview/skins/default/xui/fr/floater_flickr.xml
#	indra/newview/skins/default/xui/fr/panel_flickr_account.xml
#	indra/newview/skins/default/xui/fr/panel_flickr_photo.xml
#	indra/newview/skins/default/xui/it/floater_flickr.xml
#	indra/newview/skins/default/xui/it/panel_flickr_photo.xml
#	indra/newview/skins/default/xui/ja/floater_flickr.xml
#	indra/newview/skins/default/xui/ja/panel_flickr_photo.xml
#	indra/newview/skins/default/xui/pl/floater_avatar_render_settings.xml
#	indra/newview/skins/default/xui/pl/floater_ban_duration.xml
#	indra/newview/skins/default/xui/pl/floater_camera_presets.xml
#	indra/newview/skins/default/xui/pl/floater_classified.xml
#	indra/newview/skins/default/xui/pl/floater_create_landmark.xml
#	indra/newview/skins/default/xui/pl/floater_delete_pref_preset.xml
#	indra/newview/skins/default/xui/pl/floater_fixedenvironment.xml
#	indra/newview/skins/default/xui/pl/floater_flickr.xml
#	indra/newview/skins/default/xui/pl/floater_linkreplace.xml
#	indra/newview/skins/default/xui/pl/floater_load_pref_preset.xml
#	indra/newview/skins/default/xui/pl/floater_my_environments.xml
#	indra/newview/skins/default/xui/pl/floater_my_scripts.xml
#	indra/newview/skins/default/xui/pl/floater_notifications_tabbed.xml
#	indra/newview/skins/default/xui/pl/floater_pick_track.xml
#	indra/newview/skins/default/xui/pl/floater_preferences_graphics_advanced.xml
#	indra/newview/skins/default/xui/pl/floater_preferences_view_advanced.xml
#	indra/newview/skins/default/xui/pl/floater_preview_trash.xml
#	indra/newview/skins/default/xui/pl/floater_profile.xml
#	indra/newview/skins/default/xui/pl/floater_settings_picker.xml
#	indra/newview/skins/default/xui/pl/floater_simple_outfit_snapshot.xml
#	indra/newview/skins/default/xui/pl/menu_avatar_rendering_settings.xml
#	indra/newview/skins/default/xui/pl/menu_avatar_rendering_settings_add.xml
#	indra/newview/skins/default/xui/pl/panel_flickr_photo.xml
#	indra/newview/skins/default/xui/pl/panel_progress.xml
#	indra/newview/skins/default/xui/pl/panel_settings_sky_atmos.xml
#	indra/newview/skins/default/xui/pl/panel_settings_sky_clouds.xml
#	indra/newview/skins/default/xui/pl/panel_settings_sky_sunmoon.xml
#	indra/newview/skins/default/xui/ru/floater_flickr.xml
#	indra/newview/skins/default/xui/ru/panel_flickr_account.xml
#	indra/newview/skins/default/xui/ru/panel_flickr_photo.xml
2023-01-13 15:19:29 +01:00
Beq 0c9d4db072 [FIRE-32453][BUG-232971] Orderly shutdown of event queues
Terminate related queues before the windows thread to avoid loops. 
Also increase timeout on queue full wait as we don't expect to see this so often now.
2023-01-03 18:50:24 +00:00
Beq 6c4ba94b25 [FIRE-32453][BUG-232971] Further edge cases for thread hangs on exit 2023-01-03 10:02:01 +00:00
Beq e1479bd185 [FIRE-32453][BUG-232971] Improve shutdown behaviour. (Ty Rick Daylight)
Alter close down behaviour to ensure that the main UI window remains open until the process finishes persisting data and other close down activities.
2022-12-21 02:07:58 +00:00
Nat Goodspeed 9522a0b7c1 DRTVWR-575: Fix llcommon assumptions that size_t fits in 4 bytes.
It's a little distressing how often we have historically coded S32 or U32 to
pass a length or index.

There are more such assumptions in other viewer subdirectories, but this is a
start.
2022-11-03 14:58:32 -04:00
Ansariel 0ab3c69183 Prevent RVO elision 2022-08-01 14:21:17 +02:00
Ptolemy b504c69255 SL-16606: Add profiler category THREAD 2022-01-14 11:50:21 -08:00
Nat Goodspeed 877a02dba1 SL-16094: Fix merge glitches from previous revert. 2021-11-24 09:38:56 -05:00
Nat Goodspeed d71e0a6d47 SL-16094, SL-16400: Merge branch 'DRTVWR-546' into glthread 2021-11-23 21:23:45 -05:00
Runitai Linden 9b0d8c7e62 SL-16094 More profile hooks for threading code, remove redundant wglCreateContextAttribs call 2021-11-22 18:42:56 -06:00
Dave Houlton 029b41c041 Revert "SL-16220: Merge branch 'origin/DRTVWR-546' into glthread"
This reverts commit 5188a26a85, reversing
changes made to 819088563e.
2021-11-15 09:25:35 -07:00
Nat Goodspeed 89f2169e9d SL-16202: Add postIfOpen() methods to WorkQueue, LLThreadSafeQueue.
postIfOpen() provides a no-exception alternative to post(), which blocks if
full but throws if closed. postIfOpen() likewise blocks if full, but returns
true if able to post and false if the queue was closed.
2021-11-04 16:43:11 -04:00
Dave Parks d00272e0cc SL-16099 Multi-threaded OpenGL usage on Windows, enable Core Profile and VAOs by default. 2021-10-11 16:03:40 +00:00
Nat Goodspeed cf70766b45 SL-16024: Fix ThreadSafeSchedule::tryPopFor(), tryPopUntil().
ThreadSafeSchedule::tryPopUntil() (and therefore tryPopFor()) was simply
delegating to LLThreadSafeQueue::tryPopUntil(), with an adjusted timeout since
we want to wake up as soon as the head item, if any, becomes ready. But then
we have to loop back to retry the pop to actually deal with that head item.

In addition, ThreadSafeSchedule::popWithTime() was spinning rather than
properly blocking on a timed condition variable. Fixed.
2021-10-06 12:54:29 -04:00
Nat Goodspeed 955b967623 SL-16024: Add ThreadSafeSchedule, a timestamped LLThreadSafeQueue.
ThreadSafeSchedule orders its items by timestamp, which can be passed either
implicitly or explicitly. The timestamp specifies earliest delivery time: an
item cannot be popped until that time.

Add initial tests.

Tweak the LLThreadSafeQueue base class to support ThreadSafeSchedule:
introduce virtual canPop() method to report whether the current head item is
available to pop. The base class unconditionally says yes, ThreadSafeSchedule
says it depends on whether its timestamp is still in the future.

This replaces the protected pop_() overload accepting a predicate. Rather than
explicitly passing a predicate through a couple levels of function call, use
canPop() at the level it matters. Runtime behavior that varies depending on
an object's leaf class is what virtual functions were invented for.

Give pop_() a three-state enum return so pop() can distinguish between "closed
and empty" (throws exception) versus "closed, not yet drained because we're
not yet ready to pop the head item" (waits).

Also break out protected tryPopUntil_() method, the body logic of
tryPopUntil(). The public method locks the data structure, the protected
method requires that its caller has already done so.

Add chrono.h with a more full-featured LL::time_point_cast() function than the
one found in <chrono>, which only converts between time_point durations, not
between time_points based on different clocks.
2021-10-05 17:31:53 -04:00
Nat Goodspeed a35e266547 SL-16024: Don't use a lambda as default arg for universal reference.
Instead, break out a separate pop_() method that explicitly provides the
lambda to the real pop_() implementation.
2021-10-04 17:21:39 -04:00
Nat Goodspeed ca60fbe72c SL-16024: LLThreadSafeQueue enhancements
Add LL::PriorityQueueAdapter, a wrapper for std::priority_queue to make its
API more closely resemble std::queue for drop-in use as LLThreadSafeQueue's
underlying QueueT container.

Support move-only element types.

Factor out some implementation redundancy: wrap actual push semantics as
push_(), actual pop semantics as pop_(). push(), tryPush() and tryPushUntil()
now call push_(); pop(), tryPop() and tryPopUntil() now call pop_().

Break out tryLock() and tryLockUntil() methods that, if they can lock, run the
passed callable. Then tryPush(), tryPushUntil(), tryPop() and tryPopUntil()
pass lambdas containing the meat of the original method body to tryLock() or
tryLockUntil(), as appropriate.
2021-10-04 16:19:59 -04:00
Nat Goodspeed 7c9aeed97d SL-16024: Enhance LLThreadSafeQueue for use with WorkQueue.
First, parameterize LLThreadSafeQueue's queue type. This allows us to
substitute (e.g.) a std::priority_queue for a particular instance.

Use std::queue for the default queue type, changing the operations invoked on
the queue type from std::deque methods to std::queue methods.

Rename published methods from (e.g.) pushFront() and popBack() to simple
push() and pop(), retaining legacy names as aliases. Not only are the overt
Front and Back unnecessary; they're the opposite of how std::queue uses
std::deque or std::list, so they only confuse the reader.

Break out tryPushUntil() method. We already use that logic internally to
tryPushFor(), so it's just as easy to publish it as its own entry point.

Add tryPopFor() and tryPopUntil() to allow limiting the time we'll wait for a
queue item to become available.
2021-10-01 16:05:23 -04:00
Callum Prentice 24625c7898 Nat's suggested improvement to LLThreadSafeQueue that takes account of queue being empty as well as the status flag condition 2020-07-28 21:46:21 +03:00
Nat Goodspeed a07553c224 DRTVWR-476: Add LLThreadSafeQueue::tryPushFrontFor().
tryPushFrontFor() is pushFront() with a std::chrono::duration timeout.
2020-05-20 10:32:30 -04:00
Nat Goodspeed 98dfba0d2f DRTVWR-476: Wrap boost::fibers::mutex et al. with LLCoros aliases.
Specifically:

LLCoros::Mutex means boost::fibers::mutex
LLCoros::LockType means std::unique_lock<boost::fibers::mutex>
LLCoros::ConditionVariable means boost::fibers::condition_variable
LLCoros::cv_status means boost::fibers::cv_status

So as not to drag in all of boost::fibers::mutex.hpp or condition_variable.hpp
for each consumer of llcoros.h, instead #define LLCOROS_MUTEX_HEADER and
LLCOROS_CONDVAR_HEADER. Those who need them can #include the relevant macro.

Update llcond.h and llthreadsafequeue.h accordingly.
2020-05-14 14:51:52 -04:00
Nat Goodspeed 5c92047e82 DRTVWR-476: Introduce LLThreadSafeQueue::close().
Also isClosed() and explicit operator bool() to detect closed state.

close() causes every subsequent pushFront() to throw
LLThreadSafeQueueInterrupt. Once the queue is drained, it causes popBack() to
throw likewise.
2020-03-25 19:25:42 -04:00
Nat Goodspeed af35391114 DRTVWR-476: Make LLThreadSafeQueue coroutine-safe as well. 2020-03-25 19:07:22 -04:00
Nat Goodspeed b080b06b42 DRTVWR-494: Encapsulate redundant VS boilerplate around <mutex>. 2020-03-25 15:28:17 -04:00
andreykproductengine 8a92a771ba SL-10291 Replace apr thread with standard C++11 functionality 2019-01-15 22:27:28 +02:00
Nat Goodspeed 9c49a6c91d MAINT-5011: Introduce LLException base class for viewer exceptions.
This also introduces LLContinueError for exceptions which should interrupt
some part of viewer processing (e.g. the current coroutine) but should attempt
to let the viewer session proceed.

Derive all existing viewer exception classes from LLException rather than from
std::runtime_error or std::logic_error.

Use BOOST_THROW_EXCEPTION() rather than plain 'throw' to enrich the thrown
exception with source file, line number and containing function.
2016-07-19 16:25:25 -04:00
Oz Linden c8726aba30 remove execute permission from many files that should not have it 2015-11-10 09:48:56 -05:00
Graham Madarasz bf6182daa8 Update Mac and Windows breakpad builds to latest 2013-03-29 07:50:08 -07:00
brad kittenbrink e87b447a0c Fix for dll linkage errors. 2010-11-09 17:42:13 -08:00
Andrew A. de Laix 9ae2891a3a start of a thread safe queue 2010-11-09 15:04:44 -08:00