Search code examples
iosnsoperationqueue

Do I have to read NSOperationQueue's operationCount on the operation queue itself?


Sometimes it seems operationCount does not return the right value. Do I have to access it from the queue itself or it does not matter if I access it from an other thread?


Solution

  • "the value returned by this property reflects the instantaneous number of operations at the time the property was accessed."

    it isn't guaranteed to be precise / stable and you should NOT use it to do calculations / decisions