Hi, all,

I have a situation in which I am using two subclasses of NSOperation: one is to execute an algorithm (in this case, to simulate the rolling of dice), while the other is to log the result of that action. (I'm using an operation for the logging since the logging can take some time due to its need to process the results of the first operation.)

I have things almost working, but I'm basically wondering what others think of this.

---

The user clicks a button, and...

1a. If an operation for the main algorithm is *not* already in progress, an operation for the main algorithm begins.
1b. If the main algorithm is already going, then it is stopped.

2a. Ideally, when the main algorithm's operation finishes successfully, I would like the logging operation to begin (it will be added to a queue specifically for the logging operations). 2b. If the main algorithm's operation is cancelled, I would like to *not* perform any logging.

3a. When the logging completes successfully, we're done!
3b. If the logging is cancelled, then we're also done.

This seems like reasonable behavior to me -- but you may notice that I've left something out. With regard to step 1b: what happens if a logging operation is still in progress when the main algorithm is stopped? Ideally, would one simply stop the most recent logging operation? Stop all of them? Stop none of them, and simply let them run their course? I can see cons to all of these, and can't quite figure out what's best (e.g., for the first, what if the most recent logging operation belongs to a *previous* incarnation of the main algorithm, and not the one that's presently running? For the second, what if the user doesn't want to interrupt his or her logging, again for previous rolls, with the cancellation of the main algorithm? and, for the third, what if the user *wants* to interrupt one or all of the logging operations??).

All guidance is appreciated!

Cheers,
        Andrew

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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]

Reply via email to