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:
dispatch_main.
Hi Geordie,
I am new here and so pardon me if I misunderstood anything.
When you run a program in Swift, it already runs on main thread by default
and then you can all Dispatch async. So for example,
while true { // This while loop will run for infinite on main thread
Dispatch.main.async {} //
Hi!
I have a somewhat unusual use-case that I’m trying to figure out.
I have a command-line swift app whose main thread ends up in an infinite loop
for graphics rendering purposes (running SDL).
What I’m hoping to do is to be able to run async code like this from within
that infinite loop:
Di