I maintain a dispatch queue as a property with my view controller. I create this queue once in my view controller's init method, and reuse a few times for some background tasks. Before ARC, I was doing this:
@property (nonatomic, assign) dispatch_queue_t filterMainQueue;
And in init:
if (filterMainQueue == nil) {
filterMainQueue = dispatch_queue_create("com.myQueue.CJFilterMainQueue", NULL);
}
But after ARC, I'm not sure if this should still be "assign", or should it be "strong" or "weak". The ARC convertor script didn't change anything but I'm not sure if a subtle bug is coming from the fact that this queue might be deallocated while it's being used?
What would be the difference between the 3 types of properties, and what will work the best for a dispatch queue, when using ARC?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…