summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2021-10-04 17:21:39 -0400
committerNat Goodspeed <nat@lindenlab.com>2021-10-04 17:21:39 -0400
commita35e266547e4d2c8dbd6b003c64b719d91eaaf87 (patch)
tree0e5605f4094b2072cf1f8f59187172387db49324 /indra/llcommon
parentca60fbe72ce086fbdf0821043ad3be6aad06857c (diff)
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.
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llthreadsafequeue.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/indra/llcommon/llthreadsafequeue.h b/indra/llcommon/llthreadsafequeue.h
index c57520c01f..1dffad6b89 100644
--- a/indra/llcommon/llthreadsafequeue.h
+++ b/indra/llcommon/llthreadsafequeue.h
@@ -191,9 +191,11 @@ protected:
template <typename T>
bool push_(lock_t& lock, T&& element);
// while lock is locked, really pop the head element, if we can
+ bool pop_(lock_t& lock, ElementT& element);
+ // pop_() with an explicit predicate indicating whether the head element
+ // is ready to be popped
template <typename PRED>
- bool pop_(lock_t& lock, ElementT& element,
- PRED&& pred=[](const ElementT&){ return true; });
+ bool pop_(lock_t& lock, ElementT& element, PRED&& pred);
};
/*****************************************************************************
@@ -385,6 +387,16 @@ bool LLThreadSafeQueue<ElementT, QueueT>::tryPushUntil(
// while lock is locked, really pop the head element, if we can
template <typename ElementT, typename QueueT>
+bool LLThreadSafeQueue<ElementT, QueueT>::pop_(lock_t& lock, ElementT& element)
+{
+ // default predicate: head element, if present, is always ready to pop
+ return pop_(lock, element, [](const ElementT&){ return true; });
+}
+
+
+// pop_() with an explicit predicate indicating whether the head element
+// is ready to be popped
+template <typename ElementT, typename QueueT>
template <typename PRED>
bool LLThreadSafeQueue<ElementT, QueueT>::pop_(
lock_t& lock, ElementT& element, PRED&& pred)