Is https://github.com/apple/swift/blob/master/utils/symbolicate-linux-fatal not
working for you?
This script works around the unfortunate interaction between dladdr and ELF
local symbols. It was added a year ago. The explanation is in the SR, and the
PR with the workaround was linked from the
Something has to drain blocks sent to the main queue.
You can run a Foundation run loop. That should drain the main queue. I believe
it also ensures blocks sent to the main queue always run on the main thread.
Dispatch includes its own lower-level function to pump the main queue: