From a35e266547e4d2c8dbd6b003c64b719d91eaaf87 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 4 Oct 2021 17:21:39 -0400 Subject: 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. --- indra/llcommon/llthreadsafequeue.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') 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 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 - 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::tryPushUntil( // while lock is locked, really pop the head element, if we can template +bool LLThreadSafeQueue::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 template bool LLThreadSafeQueue::pop_( lock_t& lock, ElementT& element, PRED&& pred) -- cgit v1.2.3