Domanda

If you use dispatch_after to schedule two blocks for the same time on the main thread, is there a defined order for them to be executed in?

È stato utile?

Soluzione

There's no documentation (that I can find) guaranteeing the behavior you describe.

I looked at the source code for dispatch_after and it's a thin wrapper around dispatch_source. However, the dispatch_source source code is complex (too complex for me to dig into right now) and it certainly didn't seem obvious that it would give you the described behavior.

I suggest you avoid relying on the behavior you describe, even if it happens to work in a simple test case.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top