Commit ffc16fc
Summary:
In order to fix the data races described in #44715, I propose a simple solution by leveraging shared counter functions wherein `std::atomic` is the backing for the integer values.
## Changelog:
[iOS] [Fixed] - Implement shared atomic counters and replace static integers in `RCTImageLoader` and `RCTNetworkTask` that were accessed concurrently, which in some cases lead to data races.
Pull Request resolved: #45114
Test Plan: Added unit tests for the counters in `RCTSharedCounterTests`.
Reviewed By: cipolleschi
Differential Revision: D59155076
Pulled By: javache
fbshipit-source-id: f73afce6a816ad3226ed8c123cb2ccf4183549a0
1 parent 9833338 commit ffc16fc
File tree
2 files changed
+6
-9
lines changed- packages/react-native/Libraries
- Image
- Network
2 files changed
+6
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 35 | + | |
40 | 36 | | |
41 | 37 | | |
42 | 38 | | |
| |||
510 | 506 | | |
511 | 507 | | |
512 | 508 | | |
513 | | - | |
| 509 | + | |
514 | 510 | | |
515 | 511 | | |
516 | 512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
31 | | - | |
32 | | - | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
0 commit comments