if the calling code was already on the main thread, and the function they called also called the DispatchQueue.main.async, it seems like that call was delayed/not-called, and being requeued on the run loop for the next call.
That is correct behavior, not a bug. No matter what queue you are currently executing on, the async() call just adds your closure to the target queue and returns.
Is there any better way to debug this?
No magic bullet here, but I’ve found this function is handy for verifying assumptions about what queue you are executing on:
dispatchPrecondition(condition: .onQueue(.main)) // or whatever queue you want to check
Topic:
App & System Services
SubTopic:
Core OS
Tags: