Skip to content

Commit fd8e3dc

Browse files
committed
Fix[rmqa_producerimpl.t]: replace C++11 lambda with C++03-compatible bind
The SendFromConfirmCallbackDoesNotDeadlock test used a lambda which does not compile under C++03. Replace it with a static helper function and bdlf::BindUtil::bind.
1 parent 495c7c0 commit fd8e3dc

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

src/tests/rmqa/rmqa_producerimpl.t.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,16 @@ TEST_P(ProducerImplUpdateTopology, UpdateCallbackFromTwoThreadsAtOnce)
772772
EXPECT_TRUE(future2.blockResult());
773773
}
774774

775+
static void sendAndExpectSending(bsl::shared_ptr<rmqa::ProducerImpl>* producer,
776+
rmqt::Message* msg,
777+
bsl::shared_ptr<rmqt::Queue>* queue,
778+
rmqp::Producer::ConfirmationCallback* callback,
779+
bsls::TimeInterval* timeout)
780+
{
781+
EXPECT_THAT((*producer)->send(*msg, (*queue)->name(), *callback, *timeout),
782+
Eq(rmqp::Producer::SENDING));
783+
}
784+
775785
TEST_P(ProducerImplMaxOutstandingTests, SendFromConfirmCallbackDoesNotDeadlock)
776786
{
777787
// Regression: calling send() from within a ConfirmationCallback must not
@@ -795,11 +805,12 @@ TEST_P(ProducerImplMaxOutstandingTests, SendFromConfirmCallbackDoesNotDeadlock)
795805
// callback executes, otherwise send() would block forever (deadlock with
796806
// the old code).
797807
EXPECT_CALL(*d_mockCallback, onConfirm(msg1, _, ack))
798-
.WillOnce(InvokeWithoutArgs([&]() {
799-
EXPECT_THAT(
800-
producer->send(msg2, d_queue->name(), d_callback, d_timeout),
801-
Eq(rmqp::Producer::SENDING));
802-
}));
808+
.WillOnce(InvokeWithoutArgs(bdlf::BindUtil::bind(&sendAndExpectSending,
809+
&producer,
810+
&msg2,
811+
&d_queue,
812+
&d_callback,
813+
&d_timeout)));
803814

804815
d_injectConfirm(msg1, d_queue->name(), ack);
805816
d_threadPool.drain();

0 commit comments

Comments
 (0)