Commit Graph

1 Commits

Author SHA1 Message Date
Håkon Knutzen b1ec698dc4 Fix data race related to RCTNetworkTask.status (#44694)
Summary:
Fix entails using non-synthesized getter, such that underlying backing is an std::atomic<RCTNetworkTaskStatus>.

In the greater scheme of things, I believe `RCTNetworkTask` should be improved as it has several `nonatomic` properties that are read and written to on different threads. Thread safety of this class seems to have been addressed on a per property basis, judging from the employment of `std::mutex` elsewhere in the implementation.

This is an attempt at fixing https://github.com/facebook/react-native/issues/44687.

## Changelog:

[iOS][FIXED] - Fix data race related to access on `RCTNetworkTask.status`.

Pull Request resolved: https://github.com/facebook/react-native/pull/44694

Test Plan: Added unit test in class `RCTNetworkTaskTests`.

Reviewed By: cortinico

Differential Revision: D59217353

Pulled By: javache

fbshipit-source-id: 1af77238ddd99db21e2e53f174a81e207d5832b2
2024-07-03 08:22:26 -07:00