Thank you all for your replies and explanations; this has been extremely informative in terms of these primitive types and the respective consequences of their use!
It seems a common motif in this thread has been priority inversions and how they can come about. I would like to get a little more information about this issue, but first want to confirm my understanding:
At the most basic level a priority inversion is a situation where a thread with a high priority is waiting for a thread with a lower priority to finish -- or in the case of a semaphore or condition variable waiting for "permission" to continue by means of a signal -- whether or not the actual thread that's being waited for is known.
It also seems that a condition for classifying this as an "issue" is that the system can't elevate the priority of lower-priority thread to match the priority of the higher-priority thread, but I'm not particularly confident about this point.
Is this understanding correct or is there more nuance to this issue?
Now, thread priority and how the system schedules which threads should be running at any given time seems like a broader conversation outside of the purview of this specific thread, but if there are good resources or other threads that I could be pointed to, I would greatly appreciate that. That being said, I want to understand a bit more about the seriousness of the issue of priority inversion.
For a bit more background, I'm effectively leading the charge for my company in our transition to Swift 6. I'm working on an internal library with a number of higher-level "primitives" that are meant for consumption within our application for aiding in synchronization and creation of Sendable
types across our codebase. Also of note, we've come across the "reentrancy problem" in our own code and have sought similar solutions, but practically all suggestions in the linked thread warn against this kind of pattern due to the potential of priority inversion.
In terms of low-level system programming (e.g. daemons, kernel extensions, OS, etc.) I can certainly see priority inversion being a huge issue (as mentioned by @David_Smith above), however, in practical "Application" programming contexts how big of an issue is this really?
I am trying to balance between creating types and APIs that abstract enough of the nuances of Swift Concurrency to make it simpler for those that aren't as knowledgeable and ensuring that all of the types/APIs that I create are extremely performant and don't introduce these kinds of issues under the hood. Any guidance or tips for navigating this would be greatly appreciated.