mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix concurrent consumers issue with ReactMarker (#38710)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38710 Fix a race condition when multiple consumers try to access ReactMarker and trigger calls to native module. Even though ReactMarker uses `ConcurrentLinkedQueue`, the loop itself could race and cause NPE. Changelog: [Android][Fixed] - Fix race condition with ReactMarker calls to its native module Reviewed By: rshest Differential Revision: D47933993 fbshipit-source-id: a56e5e4f3564922d534235991da5b6842248bf24
This commit is contained in:
committed by
Facebook GitHub Bot
parent
743799078b
commit
6ab062dfec
+2
-2
@@ -193,8 +193,8 @@ public class ReactMarker {
|
||||
nativeLogMarker(name.name(), now);
|
||||
|
||||
// Then send all cached native ReactMarkers
|
||||
while (!sNativeReactMarkerQueue.isEmpty()) {
|
||||
ReactMarkerRecord record = sNativeReactMarkerQueue.poll();
|
||||
ReactMarkerRecord record;
|
||||
while ((record = sNativeReactMarkerQueue.poll()) != null) {
|
||||
nativeLogMarker(record.getMarkerName(), record.getMarkerTime());
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user