A framework for building native applications using React
Fix TaskDispatchThread (#53961)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53961 Changelog: [Internal] Fixed a bug in TaskDispatchThread. To understand bug, let me show an example. The task is scheduled to run after several seconds. It reaches loopCv_.wait_until() and waits there. There are 2 bad scenario: 1. wait_until spuriously wakes up and async task runs even before its scheduled time 2. new task is added with runSync(). New task gets added to the queue and loopCv_ is notified. Async task will run before its scheduled time and even worse queue_.pop() will remove sync task. Therefore runSync will be blocked for forever. To fix this bug, we need to add `continue` after wait_until(). Also I added new test to prevent this bug in future. Reviewed By: rshest Differential Revision: D83345047 fbshipit-source-id: 37962613a123a123c0e110426ae782effe5a81c1
N
Nurtau Toganbay committed
ad5949ffd69743cfe0ffebf1f045518df7c7c38d
Parent: 2d2011c
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 9/26/2025, 3:54:24 PM