I have to use dispatch_resume(...);
to resume a dispatch that was suspended, but as the method resuming the dispatch may be called by several parts of the app, I need to know if the dispatch is suspended before calling it to resume (the docs says I have to balance dispatch resume/suspend and cannot have more resumes than suspends, or I will end with a "negative suspension counter".
Is there a way to do test if a dispatch is suspended?
There is not, by design (and just like there is no cancellation mechanism). The notion of suspend/resume must be balanced every bit as carefully as retain/release
That is, if A suspends the queue, there is no way for B to safely know that it can resume the queue without intimate knowledge of A. Given that, there is no reason for the dispatch APIs to add the complexity of is-suspended queries and enable a whole class of bugs that would crop up all over the place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With