.. trimmed .. re-sent .. not sure how that became 24kB …
Well it all depends what you want to do really.
If your BTLE callbacks mostly end up with something being changed in the UI, and they are quick to execute, then running them on the main queue is fine, you’re going to have to bounce the UI updates to that queue anyway. The rule is "don’t block the main queue", not "don’t use the main queue".
The original code you posted is possibly a little odd, but it’s not entirely stupid. (that’s the code which sets up a queue targetting the main queue). The queue is named, which means you can track it easier in the debugger, if you decide later you want to use a background queue instead, you just switch the target. You can also suspend and resume that queue if for some reason you wanted to temporarily stop receiving BTLE callbacks.
I have no idea why it’s written like that - perhaps looking at the rest of the code might yield some places it does something specific with that queue, like suspend, resume or re-target it.
Hi Thirumalrao,
Thanks for you response but the code is exactly what I posted. Your code will also execute BLE actions off of the main thread - the merits/demerits of this was the essence of my question.
Kind regards,
Andrew Coad
|