impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Impala Public Jenkins (Code Review)" <>
Subject [Impala-ASF-CR] Allow BlockingQueue and ThreadPool to accept rvalue args
Date Thu, 20 Apr 2017 02:56:43 GMT
Impala Public Jenkins has submitted this change and it was merged.

Change subject: Allow BlockingQueue and ThreadPool to accept rvalue args

Allow BlockingQueue and ThreadPool to accept rvalue args

Previously the BlockingQueue and ThreadPool APIs only accepted const
lvalue references, so the argument was always copied into the
queue. Very often we create a thin wrapper for each work item we submit
to a thread pool, and will not want to use that object again, so moving
it into the pool rather than copying makes the most sense.

Note the introduction of an extra template parameter into Offer() and
BlockingPut*(). To enable perfect-forwarding (i.e. allow the methods to
accept rvalue or lvalues and pass them through), we need to use a)
rvalue references (V&&) and b) do so in a 'type-deducing
context' [1]. Having the enclosing class be template-parameterized does not
count as type-deducing, so we add the dummy V parameter and the compiler
will ensure that V is properly compatible with the original T type.


Change-Id: I1791870576cb269e86495034f92555de48f92f10
Reviewed-by: Henry Robinson <>
Tested-by: Impala Public Jenkins
M be/src/rpc/TAcceptQueueServer.cpp
M be/src/util/blocking-queue.h
M be/src/util/thread-pool.h
3 files changed, 22 insertions(+), 10 deletions(-)

  Impala Public Jenkins: Verified
  Henry Robinson: Looks good to me, approved

To view, visit
To unsubscribe, visit

Gerrit-MessageType: merged
Gerrit-Change-Id: I1791870576cb269e86495034f92555de48f92f10
Gerrit-PatchSet: 5
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Henry Robinson <>
Gerrit-Reviewer: Alex Behm <>
Gerrit-Reviewer: Dan Hecht <>
Gerrit-Reviewer: Henry Robinson <>
Gerrit-Reviewer: Impala Public Jenkins

View raw message