react-native-windows 0.81.35 → 0.81.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +48 -2
  2. package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +40 -13
  3. package/Microsoft.ReactNative/TurboModulesProvider.cpp +30 -13
  4. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  5. package/Scripts/creaternwlib.cmd +2 -2
  6. package/external/fast-float/.syncignore +0 -1
  7. package/external/fast-float/README.md +545 -0
  8. package/external/fmt/.syncignore +0 -2
  9. package/external/fmt/README.md +484 -0
  10. package/external/fmt/doc/ChangeLog-old.md +3290 -0
  11. package/external/fmt/doc/api.md +650 -0
  12. package/external/fmt/doc/fmt.css +61 -0
  13. package/external/fmt/doc/fmt.js +4 -0
  14. package/external/fmt/doc/get-started.md +222 -0
  15. package/external/fmt/doc/index.md +151 -0
  16. package/external/fmt/doc/perf.svg +1 -0
  17. package/external/fmt/doc/python-license.txt +290 -0
  18. package/external/fmt/doc/syntax.md +887 -0
  19. package/external/folly/.syncignore +2 -3
  20. package/external/folly/README.md +263 -0
  21. package/external/folly/folly/docs/AtomicHashMap.md +134 -0
  22. package/external/folly/folly/docs/Benchmark.md +310 -0
  23. package/external/folly/folly/docs/Conv.md +291 -0
  24. package/external/folly/folly/docs/Dynamic.md +220 -0
  25. package/external/folly/folly/docs/DynamicConverter.md +71 -0
  26. package/external/folly/folly/docs/Executors.md +63 -0
  27. package/external/folly/folly/docs/FBString.md +46 -0
  28. package/external/folly/folly/docs/FBVector.md +200 -0
  29. package/external/folly/folly/docs/Fbvector--graphical_solutions.png +0 -0
  30. package/external/folly/folly/docs/Format.md +177 -0
  31. package/external/folly/folly/docs/Function.md +92 -0
  32. package/external/folly/folly/docs/Futures.md +263 -0
  33. package/external/folly/folly/docs/GroupVarint.md +46 -0
  34. package/external/folly/folly/docs/Histogram.md +104 -0
  35. package/external/folly/folly/docs/MapUtils.md +80 -0
  36. package/external/folly/folly/docs/Overview.md +263 -0
  37. package/external/folly/folly/docs/PackedSyncPtr.md +77 -0
  38. package/external/folly/folly/docs/Poly.md +500 -0
  39. package/external/folly/folly/docs/ProducerConsumerQueue.md +82 -0
  40. package/external/folly/folly/docs/Rcu.md +218 -0
  41. package/external/folly/folly/docs/SmallLocks.md +24 -0
  42. package/external/folly/folly/docs/Synchronized.md +793 -0
  43. package/external/folly/folly/docs/ThreadCachedInt.md +98 -0
  44. package/external/folly/folly/docs/ThreadLocal.md +105 -0
  45. package/external/folly/folly/docs/Traits.md +161 -0
  46. package/external/folly/folly/docs/small_vector.md +64 -0
  47. package/external/folly/folly/docs/style.css +23 -0
  48. package/external/folly/static/logo.svg +1 -0
  49. package/package.json +2 -2
  50. package/templates/cpp-lib/example/metro.config.js +31 -6
  51. package/Scripts/Warm-RnwFeedCache.ps1 +0 -413
@@ -0,0 +1,218 @@
1
+ `folly/synchronization/Rcu.h`
2
+ ----------------------
3
+
4
+ C++ read-copy-update (RCU) functionality in folly.
5
+
6
+ ## Overview
7
+ ***
8
+
9
+ Read-copy-update (RCU) is a low-overhead synchronization mechanism that provides
10
+ guaranteed ordering between operations on shared data. In the simplest usage
11
+ pattern, readers enter a critical section, view some state, and leave the
12
+ critical section, while writers modify shared state and then defer some cleanup
13
+ operations.
14
+
15
+ Proper use of the APIs provided by folly RCU will guarantee that a cleanup
16
+ operation that is deferred during a reader critical section will not be executed
17
+ until after that critical section is over.
18
+
19
+ ## Usage
20
+ ***
21
+
22
+ ### folly::rcu_domain
23
+
24
+ The main synchronization primitive in folly RCU is a `folly::rcu_domain`. A
25
+ `folly::rcu_domain` is a "universe" of deferred execution. Each domain has an
26
+ executor on which deferred functions may execute. `folly::rcu_domain` provides
27
+ the requirements to be
28
+ [BasicLockable](https://en.cppreference.com/w/cpp/named_req/BasicLockable), and
29
+ readers may enter a read region in a `folly::rcu_domain` by treating the domain
30
+ as a mutex type that can be wrapped by C++ locking primitives.
31
+
32
+ For example, to enter and exit a read region using non-movable RAII semantics,
33
+ you could use an `std::scoped_lock`:
34
+
35
+ ```Cpp
36
+ {
37
+ std::scoped_lock<folly::rcu_domain> lock(folly::rcu_default_domain());
38
+ protectedData.read();
39
+ }
40
+ ```
41
+
42
+ Alternatively, if you need to be able to move the lock, you could use
43
+ `std::unique_lock`:
44
+
45
+ ```Cpp
46
+ class ProtectedData {
47
+ private:
48
+ std::unique_lock<folly::rcu_domain> lock_;
49
+ void* data_;
50
+ }
51
+ ```
52
+
53
+ ### Default vs. custom domains
54
+
55
+ There is a global, default domain that can be accessed using
56
+ `folly::rcu_default_domain()` as in the example above. If required, you can also
57
+ create your own domain:
58
+
59
+ ```Cpp
60
+ {
61
+ Executor* my_executor = getExecutor();
62
+ folly::rcu_domain domain(my_executor /* or nullptr to use default */);
63
+ }
64
+ ```
65
+
66
+ In general, using the default domain is strongly encouraged as you will likely
67
+ get better cache locality by sharing a domain that it used by other callers in
68
+ process. If, however, you can't avoid blocking during reader critical sections,
69
+ your own custom domain should be used to avoid delaying reclamation from other
70
+ updaters. A custom domain can also be used if you want update callbacks to be
71
+ invoked on a specific executor.
72
+
73
+ ### Updates and retires
74
+
75
+ A typical reader / updater synchronization will look something like this:
76
+
77
+ ```Cpp
78
+ void doSomethingWith(IPAddress host);
79
+
80
+ static std::atomic<ConfigData*> globalConfigData;
81
+
82
+ void reader() {
83
+ while (true) {
84
+ IPAddress curManagementServer;
85
+ {
86
+ // We're about to do some reads we want to protect; if we read a
87
+ // pointer, we need to make sure that if the writer comes along and
88
+ // updates it, the writer's cleanup operation won't happen until we're
89
+ // done accessing the pointed-to data. We get a Guard on that
90
+ // domain; as long as it exists, no function subsequently passed to
91
+ // invokeEventually will execute.
92
+ std::scoped_lock<folly::rcu_domain> guard(folly::rcu_default_domain());
93
+ ConfigData* configData = globalConfigData.load(std::memory_order_consume);
94
+ // We created a guard before we read globalConfigData; we know that the
95
+ // pointer will remain valid until the guard is destroyed.
96
+ curManagementServer = configData->managementServerIP;
97
+ // RCU domain via the scoped mutex is released here; retired objects
98
+ // may be freed.
99
+ }
100
+ doSomethingWith(curManagementServer);
101
+ }
102
+ }
103
+
104
+ void writer() {
105
+ while (true) {
106
+ std::this_thread::sleep_for(std::chrono::seconds(60));
107
+ ConfigData* oldConfigData = globalConfigData.load(std::memory_order_relaxed);
108
+ ConfigData* newConfigData = loadConfigDataFromRemoteServer();
109
+ globalConfigData.store(newConfigData, std::memory_order_release);
110
+ folly::rcu_retire(oldConfigData);
111
+ // Alternatively, in a blocking manner:
112
+ // folly::rcu_synchronize();
113
+ // delete oldConfigData;
114
+ }
115
+ }
116
+ ```
117
+ In the example above, a single writer updates `ConfigData*` in a loop, and then
118
+ defers freeing it until all RCU readers have exited their read regions. The
119
+ writer may use either of the following two APIs to safely defer freeing the
120
+ old `ConfigData*`:
121
+
122
+ * `rcu_retire()`: To schedule the asynchronous deletion of the `oldConfigData` pointer when all readers have exited their read regions.
123
+ * `rcu_synchronize()`: To block the calling thread until all readers have exited their read regions, at which point the pointer is safe to be deleted.
124
+
125
+ If you expect there to be very long read regions, it may be required to use
126
+ `rcu_synchronize()` or a periodic `rcu_barrier()` (described below) to avoid
127
+ running out of memory due to delayed reclamation.
128
+
129
+
130
+ ### folly::rcu_barrier()
131
+
132
+ Another synchronization primitive provided by the folly RCU library is
133
+ `rcu_barrier()`. Unlike `rcu_synchronize()`, which blocks until all outstanding
134
+ readers have exited their read regions, `rcu_barrier()` blocks until all
135
+ outstanding *deleters* (specified in a call to `rcu_retire()`) are completed.
136
+
137
+ As mentioned above, one example of where this may be useful is avoiding
138
+ out-of-memory errors due to scheduling too many objects whose reclamation is
139
+ delayed. Taking our example from above, we could avoid OOMs using a periodic
140
+ invocation to `rcu_barrier()` as follows:
141
+
142
+ ```Cpp
143
+ static std::atomic<ConfigData*> globalConfigData;
144
+
145
+ void writer() {
146
+ uint32_t retires = 0;
147
+ while (true) {
148
+ std::this_thread::sleep_for(std::chrono::seconds(60));
149
+ ConfigData* oldConfigData = globalConfigData.load(std::memory_order_relaxed);
150
+ ConfigData* newConfigData = loadConfigDataFromRemoteServer();
151
+ globalConfigData.store(newConfigData, std::memory_order_release);
152
+ if (retires++ % 1000 == 0) {
153
+ folly::rcu_barrier();
154
+ }
155
+ folly::rcu_retire(oldConfigData);
156
+ }
157
+ }
158
+ ```
159
+
160
+ ### Custom deleter in folly::rcu_retire
161
+
162
+ When invoking `folly::rcu_retire()`, you may optionally also pass a custom
163
+ deleter function that is invoked instead of
164
+ [`std::default_delete`](https://en.cppreference.com/w/cpp/memory/default_delete):
165
+
166
+ ```Cpp
167
+ #include <folly/logging/xlog.h>
168
+
169
+ static std::atomic<ConfigData*> globalConfigData;
170
+
171
+ void writer() {
172
+ while (true) {
173
+ std::this_thread::sleep_for(std::chrono::seconds(60));
174
+ ConfigData* oldConfigData = globalConfigData.load(std::memory_order_relaxed);
175
+ ConfigData* newConfigData = loadConfigDataFromRemoteServer();
176
+ globalConfigData.store(newConfigData, std::memory_order_release);
177
+ folly::rcu_retire(oldConfigData, [](ConfigData* obj) {
178
+ XLOG(INFO) << "Deleting retired config " << oldConfigData->version);
179
+ delete obj;
180
+ });
181
+ }
182
+ }
183
+ ```
184
+
185
+ ### API limitations of updaters
186
+
187
+ Exceptions may not be thrown at any point in a retire callback. This includes
188
+ both the deleter, as well as the object's destructor. Other than this, any
189
+ operation is safe from within a retired object's destructor, including retiring
190
+ other objects, or even retiring the same object as long as the custom deleter
191
+ did not free it.
192
+
193
+ When using the default domain or the default executor, it is not legal to hold a
194
+ lock across an `rcu_retire()` that is acquired by the deleter. This is normally
195
+ not a problem when using the default deleter `delete`, which does not acquire
196
+ any user locks. However, even when using the default deleter, an object having
197
+ a user-defined destructor that acquires locks held across the corresponding call
198
+ to `rcu_retire()` can still deadlock.
199
+
200
+ Note as well that there is no guarantee of the order in which retire callbacks
201
+ are invoked. A retire callback is guaranteed to be invoked only after all
202
+ readers that were present when the callback was scheduled have exited.
203
+ Otherwise, any ordering of callback invocation may occur.
204
+
205
+ ### Note on fork()
206
+
207
+ `fork()` may not be invoked in a multithreaded program where any thread other
208
+ than the calling thread is in an RCU read region. Doing so will result in
209
+ undefined behavior, and will likely lead to deadlock. If the forking thread is
210
+ inside of an RCU read region, it must invoke `exec()` before exiting the read
211
+ region.
212
+
213
+ ## Performance
214
+ ***
215
+
216
+ `std::scoped_lock<folly::rcu_domain>` creation/destruction is on the order of
217
+ ~5ns. By comparison, `folly::SharedMutex::lock_shared()` followed by
218
+ `folly::SharedMutex::unlock_shared()` is ~26ns.
@@ -0,0 +1,24 @@
1
+ `folly/SmallLocks.h`
2
+ --------------------
3
+
4
+ This module is currently x64 only.
5
+
6
+ This header defines two very small mutex types. These are useful in
7
+ highly memory-constrained environments where contention is unlikely.
8
+ The purpose of these is to allow fine-grained locking in massive data
9
+ structures where memory is at a premium. Often, each record may have
10
+ a spare bit or byte lying around, so sometimes these can be tacked on
11
+ with no additional memory cost.
12
+
13
+ There are two types exported from this header. `MicroSpinLock` is a
14
+ single byte lock, and `PicoSpinLock` can be wrapped around an
15
+ integer to use a single bit as a lock. Why do we have both?
16
+ Because you can't use x64 `bts` on a single byte, so
17
+ `sizeof(MicroSpinLock)` is smaller than `sizeof(PicoSpinLock)` can
18
+ be, giving it some use cases.
19
+
20
+ Both the locks in this header model the C++11 Lockable concept. So
21
+ you can use `std::lock_guard` or `std::unique_lock` to lock them in an
22
+ RAII way if you want.
23
+
24
+ Additional information is in the header.