Or are you saying that both setting and getting the doubleValue should both be done synchronously?
I’m saying that:
In generally I recommend async for everything.
If you do stuff synchronously, only do it synchronously in one direction.
With regards the last point, my experience is it’s better to reserve your synchronous direction for the ‘main thread to worker thread’ case because:
The main thread is most likely to be the one that finds itself in a situation where it has to respond synchronously. The worker thread is already doing with… well… threading, and thus it’s easier to adapt it to deal with the async call.
The main thread can often experience significant latency, and thus a synchronous ‘worker thread to main thread’ call can end up blocking your worker thread for a while.
However, that’s only a rough guideline. If you can guarantee that the main thread never calls the worker thread synchronously (either directly or indirectly) and that your main thread is always responsive, going the other way is feasible.
Taking a step back, I’m curious about the goal you described in your first post. Why does your background thread need to get progress information from your UI? Normally progress flows the other direction, that is, the UI updates based on progress being made by the background thread.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"