質問

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?

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top