Skip to content

Commit

Permalink
pw_sync_freertos: Fix regression in TimedThreadNotification
Browse files Browse the repository at this point in the history
pwrev.dev/256695 contained a bug caused by the incorrect use of `auto`
with a reference type that created a copy of a thread notification's
NativeThreadNotification. Fix the issue by adding in explicit types.

Bug: 366374135
Change-Id: If259727acb223e415634e70ab4176591f811b32f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/256793
Lint: Lint 🤖 <[email protected]>
Pigweed-Auto-Submit: Kesavan Yogeswaran <[email protected]>
Commit-Queue: Kesavan Yogeswaran <[email protected]>
Docs-Not-Needed: Kesavan Yogeswaran <[email protected]>
Presubmit-Verified: CQ Bot Account <[email protected]>
Reviewed-by: Prabhu Karthikeyan Rajasekaran <[email protected]>
Reviewed-by: Alan Rosenthal <[email protected]>
  • Loading branch information
kesyog authored and CQ Bot Account committed Dec 30, 2024
1 parent 52e4852 commit 9a839e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pw_sync_freertos/timed_thread_notification.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bool TimedThreadNotification::try_acquire_until(
PW_DCHECK(xTaskNotifyStateClear(nullptr) == pdFALSE);

{
auto handle = native_handle();
native_handle_type handle = native_handle();
std::lock_guard lock(handle.shared_spin_lock);
const bool notified = handle.notified;
// Don't block if we've already reached the specified deadline time.
Expand All @@ -87,7 +87,7 @@ bool TimedThreadNotification::try_acquire_until(
}
}

auto handle = native_handle();
native_handle_type handle = native_handle();
std::lock_guard lock(handle.shared_spin_lock);
// We need to clear the thread notification state in case we were
// notified after timing out but before entering this critical section.
Expand Down

0 comments on commit 9a839e8

Please sign in to comment.