Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top