문제

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