Skip to content

Commit

Permalink
Fix deprecated this capture in wangle/bootstrap/AcceptRoutingHandler-…
Browse files Browse the repository at this point in the history
…inl.h

Summary:
In the future LLVM will require that lambdas capture `this` explicitly. `-Wdeprecated-this-capture` checks for and enforces this now.

This diff adds an explicit `this` capture to a lambda to fix an issue that presents similarly to this:
```
   -> fbcode/path/to/my_file.cpp:66:47: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-
Wdeprecated-this-capture]
   ->           detail::createIOWorkerProvider(evb, requestsRegistry_);
   ->                                               ^
   -> fbcode/path/to/my_file.cpp:61:30: note: add an explicit capture of 'this' to capture '*this' by reference
   ->   evb->runInEventBaseThread([=, self_weak = std::move(self_weak)]() {
   ->                              ^
   ->                               , this
```

Reviewed By: meyering

Differential Revision: D52279231

fbshipit-source-id: 9b9ae7dc3f4c2e65764bb45457cb6538f69a2d62
  • Loading branch information
r-barnes authored and facebook-github-bot committed Dec 19, 2023
1 parent 484af8e commit cd08966
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wangle/bootstrap/AcceptRoutingHandler-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ void AcceptRoutingHandler<Pipeline, R>::onRoutingData(
auto acceptor = acceptors_[hash % acceptors_.size()];

originalEvb->runInLoop(
[=, routingData = std::move(routingData)]() mutable {
[=, this, routingData = std::move(routingData)]() mutable {
// Switch to the new acceptor's thread
acceptor->getEventBase()->runInEventBaseThread(
[=, routingData = std::move(routingData)]() mutable {
[=, this, routingData = std::move(routingData)]() mutable {
socket->attachEventBase(acceptor->getEventBase());

auto routingHandler =
Expand Down

0 comments on commit cd08966

Please sign in to comment.