PINOperation icon indicating copy to clipboard operation
PINOperation copied to clipboard

Performance group cancel.

Open kinarobin opened this issue 5 years ago • 1 comments

  1. Once you want cancel group, the _groupToOperationReferences contains all object,
for (id <PINOperationReference>operationReference in [_groupToOperationReferences objectEnumerator]) 
{
     if ([_operationQueue cancelOperation:operationReference]) {
            dispatch_group_leave(_group);
     }  
}

Execute all object's cancelOperation is so expensive, So I remove single operationReference when single operation had finished.

  1. If the group start, it's not necessary to nil out the containers.
  _operations = nil;
  _operationPriorities = nil;
  _operationReferences = nil;

Just remove all objects. Thus support adding operations after completion or cancelation.

kinarobin avatar Jun 22 '19 07:06 kinarobin

1 Warning
:warning: Any source code changes should have an entry in CHANGELOG.md or have #trivial in their title.

Generated by :no_entry_sign: Danger

ghost avatar Jun 24 '19 15:06 ghost