Skip to content

Commit

Permalink
Fix implicit capture of "this" in SaturatingSemaphore.h
Browse files Browse the repository at this point in the history
Summary: Implicit capture of `this` by value is deprecated in C++ 20 and will produce a compiler warning. Replace the capture with explicit `this`.

Reviewed By: ot

Differential Revision: D49314861

fbshipit-source-id: 6d81dc030bd03226635eb538c7eaf4cae4f2f3b9
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Sep 15, 2023
1 parent 05ba1cf commit 61c11d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions folly/synchronization/SaturatingSemaphore.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ template <typename Clock, typename Duration>
FOLLY_NOINLINE bool SaturatingSemaphore<MayBlock, Atom>::tryWaitSlow(
const std::chrono::time_point<Clock, Duration>& deadline,
const WaitOptions& opt) noexcept {
switch (detail::spin_pause_until(deadline, opt, [=] { return ready(); })) {
switch (detail::spin_pause_until(deadline, opt, [this] { return ready(); })) {
case detail::spin_result::success:
return true;
case detail::spin_result::timeout:
Expand All @@ -285,7 +285,7 @@ FOLLY_NOINLINE bool SaturatingSemaphore<MayBlock, Atom>::tryWaitSlow(
}

if (!MayBlock) {
switch (detail::spin_yield_until(deadline, [=] { return ready(); })) {
switch (detail::spin_yield_until(deadline, [this] { return ready(); })) {
case detail::spin_result::success:
return true;
case detail::spin_result::timeout:
Expand Down

0 comments on commit 61c11d7

Please sign in to comment.