I tried to keep removing components until the deadlock disappear (after all, serializing everything won't deadlock). So I found that for a dead lock to happen, you need to repeatedly and concurrently do the following:
- You run a block in
dispatchQueue
, - The block prints anything,
- The block runs
print(X)
on a separated concurrent queue, whereX
isCustomStringConvertible
that usesdispatchQueue
insidedescription
.
#3 is extremely peculiar. As you've mentioned, it needs to be exactly print(X)
, any other variations will make the deadlock disappear, including
print(X.description)
print("\(X)")
_ = "\(X)"
let desc = "\(X)"
print(desc)
Making me thing there might be some problem with the compiler.
PS
In all seriousness, I planned to suggest that you use print("\(X)")
just to confuse you even further