My (Leopard) app needs to create a sequence of NSOperations, often thousands
of them, a few at a time. The relevant code is in a setup function that
ends with
for (k = 0;k < numOps;k++) {
solverOp *thisOp = [solverOp new];
[thisOp initWithData:Data];
[opQueue addOperation:thisOp];
}
at which point the setup code exits.
I had always *assumed* that, since an NSOperation was allocated (not just
declared), it would automatically persist long enough to do its job -- in
other words, with GC supported, retain count would trump "scope" (as above).
However, I cannot find any sample code that exemplifies this so I became
concerned that it might not be true.
Is the setup code fragment above correct or must NSOperations be retained in
scope explicitly until the operation is finished?
TIA.
--
Mike McLaughlin
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]