I have a class that uses a mutable array that is modified once after a lot of reads (new items arrive).
The problem is that when times comes to mutate the array, reads keep coming.
Currently to avoid this issue every time it reads something it does so over a copy:
[[theArray copy] operation] //operation being indexOfObject:, objectAtIndex: objectsAtIndexes:, etc.
The copy is becoming really expensive, especially when there is no need to (all those times when the array is not being mutated).
How can I lock the array to delay the access to it when is being mutated?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…