Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Stopping a function before it is finished.

From: greggirwin:mindspring at: 29-Oct-2002 9:53

Hi Alan, << Suppose that during processing, I notice that I have entered the wrong password, and now I want to stop processing the file immediately, instead of waiting til it is done. >> What I've done quite a bit in the past is designed the processing code to check for an 'abort flag periodically during processing. The flag is generally set by some user action or change in the system. That's not always a reliable system, depending on how the underlying event processing is done, and is also subject to changing behaviors due to changes in the underlying event system. For that reason, my preferred solution is to use a state machine that is fed events, one of which may be an 'abort event naturally. The cleanest, simplest, most robust solution is sometimes found after trying a few bad ones. :) --Gregg