summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2021-11-24 09:43:37 -0500
committerNat Goodspeed <nat@lindenlab.com>2021-11-24 09:43:37 -0500
commit78d837789a3741c65c3334934d96a505a522ee43 (patch)
treeb3d292a913f369fe63dc362a5be1da27cfad39cc /indra/llcommon
parent877a02dba1df8a5d7d9f40b04d6be834ed9864da (diff)
SL-16400: Make WorkQueue::runFor() and runUntil() stop when done.
runFor(interval) and runUntil(timestamp) are intended, and documented, to run *no longer than* the specified time. Instead, the initial implementation always waited the full specified time, hoping for work to arrive. Fix that: once we clear work that's already pending, return right away.
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/workqueue.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/indra/llcommon/workqueue.cpp b/indra/llcommon/workqueue.cpp
index 1e89d87cff..e7d40354aa 100644
--- a/indra/llcommon/workqueue.cpp
+++ b/indra/llcommon/workqueue.cpp
@@ -78,8 +78,8 @@ bool LL::WorkQueue::runUntil(const TimePoint& until)
LL_PROFILE_ZONE_SCOPED;
// Should we subtract some slop to allow for typical Work execution time?
// How much slop?
- Work work;
- while (TimePoint::clock::now() < until && mQueue.tryPopUntil(until, work))
+ // runUntil() is simply a time-bounded runPending().
+ for (Work work; TimePoint::clock::now() < until && mQueue.tryPop(work); )
{
callWork(work);
}