I'm new to the threading topic with Swift and would appreciate help in deciding the best approach to locking access to a variable in a package when multiple threads may be accessing the package.
For example, assume a variable defines
pi with a given accuracy. I need to lock access to this variable while it is being calculated with a certain precision. I can't guarantee the user of my package will be an actor or have appropriate locks in place. What would be the best approach to use?