When sampling one of my projects the other day, I found calls to DispatchQueue.async ended up going through a symbol called _swift_dispatch_syncTm. This appears to be an indirection stub that the compiler has inserted around calls to _swift_dispatch_async (and probably _swift_dispatch_sync too but I didn't check). The stub's implementation looks like (courtesy of Hopper):
void __swift_dispatch_syncTm(int arg0, int arg1, int arg2) {
[arg0 retain];
[arg1 retain];
(arg2)(arg0, arg1);
[arg0 release];
[arg1 release];
return;
}
I can't figure out why this exists though or why the compiler is synthesizing it (since I can't find any trace of it in the Dispatch sources). Retaining the arguments before calling the C function doesn't actually do anything useful.
I have never seen this before.
You can find it in libswiftDispatch.dylib created by Swift 4.0.3.
I didn't doubt that ; ). I just meant I have never been involved in discussions on this topic.