summaryrefslogtreecommitdiff
path: root/indra/llcommon/llthreadsafequeue.h
AgeCommit message (Collapse)Author
2024-05-16Merge tag '7.1.7-release'Erik Kundiman
source for viewer 7.1.7.8974243247
2024-04-29#824 Process source files in bulk: replace tabs with spaces, convert CRLF to ↵Andrey Lihatskiy
LF, and trim trailing whitespaces as needed
2023-09-15Remove std::move on Linux as it fails GCCErik Kundiman
"moving a local object in a return statement prevents copy elision [-Werror=pessimizing-move]" We're back to using GCC cause Clang somehow causes CPack to not work.
2022-11-03DRTVWR-575: Fix llcommon assumptions that size_t fits in 4 bytes.Nat Goodspeed
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-01-14SL-16606: Add profiler category THREADPtolemy
2021-11-24SL-16094: Fix merge glitches from previous revert.Nat Goodspeed
2021-11-23SL-16094, SL-16400: Merge branch 'DRTVWR-546' into glthreadNat Goodspeed
2021-11-22SL-16094 More profile hooks for threading code, remove redundant ↵Runitai Linden
wglCreateContextAttribs call
2021-11-15Revert "SL-16220: Merge branch 'origin/DRTVWR-546' into glthread"Dave Houlton
This reverts commit 5188a26a8521251dda07ac0140bb129f28417e49, reversing changes made to 819088563e13f1d75e048311fbaf0df4a79b7e19.
2021-11-04SL-16202: Add postIfOpen() methods to WorkQueue, LLThreadSafeQueue.Nat Goodspeed
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-10-11SL-16099 Multi-threaded OpenGL usage on Windows, enable Core Profile and ↵Dave Parks
VAOs by default.
2021-10-06SL-16024: Fix ThreadSafeSchedule::tryPopFor(), tryPopUntil().Nat Goodspeed
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-05SL-16024: Add ThreadSafeSchedule, a timestamped LLThreadSafeQueue.Nat Goodspeed
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-04SL-16024: Don't use a lambda as default arg for universal reference.Nat Goodspeed
Instead, break out a separate pop_() method that explicitly provides the lambda to the real pop_() implementation.
2021-10-04SL-16024: LLThreadSafeQueue enhancementsNat Goodspeed
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-01SL-16024: Enhance LLThreadSafeQueue for use with WorkQueue.Nat Goodspeed
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.
2020-07-28Nat's suggested improvement to LLThreadSafeQueue that takes account of queue ↵Callum Prentice
being empty as well as the status flag condition
2020-05-20DRTVWR-476: Add LLThreadSafeQueue::tryPushFrontFor().Nat Goodspeed
tryPushFrontFor() is pushFront() with a std::chrono::duration timeout.
2020-05-14DRTVWR-476: Wrap boost::fibers::mutex et al. with LLCoros aliases.Nat Goodspeed
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-03-25DRTVWR-476: Introduce LLThreadSafeQueue::close().Nat Goodspeed
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-25DRTVWR-476: Make LLThreadSafeQueue coroutine-safe as well.Nat Goodspeed
2020-03-25DRTVWR-494: Encapsulate redundant VS boilerplate around <mutex>.Nat Goodspeed
2019-01-15SL-10291 Replace apr thread with standard C++11 functionalityandreykproductengine
2016-07-19MAINT-5011: Introduce LLException base class for viewer exceptions.Nat Goodspeed
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.
2015-11-10remove execute permission from many files that should not have itOz Linden
2013-03-29Update Mac and Windows breakpad builds to latestGraham Madarasz
2010-11-09Fix for dll linkage errors.brad kittenbrink
2010-11-09start of a thread safe queueAndrew A. de Laix