I'm writing a Cocoa Obj-C application that has a single operation. It will work through a loop (for or while) in a single window. I've gotten the interface working, but I'm stuck as to how best to implement a "cancel operation" button. What sort of code would I need to cancel the method that is started by the "DO work" button? Is there a single cancel operation that I can implement?