mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
ad5949ffd6
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