mirror of
https://github.com/apple/swift.git
synced 2026-02-27 18:26:24 +01:00
Swift's dynamic exclusivity checking relies on two functions, _swift_getExclusivityTLS and _swift_setExclusivityTLS, to properly deal with multi-threaded contexts. In the non-Embedded standard library, these are provided by the Swift runtime. For Embedded Swift, we cannot rely on having thread-local storage. Instead, require the platform to provide these two entrypoints. To make things simpler, we offer two implementations one can link in: - libswiftExclusivitySingleThreaded.a: single-threaded implementation - libswiftExclusivityC11ThreadLocal.a: multi-threaded implementation that uses C11 thread-locals Embedded Swift programs using dynamic exclusivity can link in one of these libraries, or can implement its own versions of these two functions. A platform can choose to provide them if it has different mechanisms for thread-local storage. This makes dynamic exclusivity checking generally usable in Embedded Swift, rdar://159115910.
1.1 KiB
1.1 KiB