Skip to content

Commit c16aa05

Browse files
[CP-stable][win32] Remove the predicate from TimerThread condition variable (#193238)
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request) Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request. ### Issue Link: What is the link to the issue this cherry-pick is addressing? #192513 ### Impact Description: This impacts production apps on Windows. The apps can get stuck when waiting for a timer. ### Workaround: Is there a workaround for this issue? No workaround ### Risk: What is the risk level of this cherry-pick? ### Test Coverage: Are you confident that your fix is well-tested by automated tests? ### Validation Steps: What are the steps to validate that this fix works? < Replace with validation steps here >
1 parent 905ca64 commit c16aa05

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎engine/src/flutter/shell/platform/windows/task_runner_window.cc‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ void TimerThread::ScheduleAt(
5959
void TimerThread::TimerThreadMain() {
6060
std::unique_lock<std::mutex> lock(mutex_);
6161
while (callback_ != nullptr) {
62-
cv_.wait_until(lock, next_fire_time_, [this]() {
63-
return std::chrono::high_resolution_clock::now() >= next_fire_time_ ||
64-
callback_ == nullptr;
65-
});
62+
cv_.wait_until(lock, next_fire_time_);
63+
if (next_fire_time_ > std::chrono::high_resolution_clock::now()) {
64+
continue;
65+
}
6666
auto scheduled_count = schedule_counter_;
6767
if (callback_) {
6868
lock.unlock();

0 commit comments

Comments
 (0)