[Jprogramming] Soft-stopping of a long loop
Oleg Kobchenko
olegykj at yahoo.com
Wed Jan 16 14:12:47 HKT 2008
Still for completeness, you may want to look at
http://www.jsoftware.com/jwiki/Guides/Windows_Progress_Dialog
The fexist test is the easiest, though it is easier to
delete existing file to stop rather than to create.
Think about "a button on the same form [as long-running code]".
The code does not run on the form. So the form with progress
and cancel button can be in a separate instance to overcome
the single-threadedness.
See also "wdstatus" in
http://www.jsoftware.com/help/user/script_winlib.htm
Maybe we need a command with simplicity of "wdstatus" interface
and implemented as wdstatus box with cancel button in a
remote J instance controlled with jsss/jssc.
Regarding repetative repaints such as plot in a loop:
If you re-read http://www.jsoftware.com/help/user/message_pump.htm
there is 5-second clause. Which means that you may need
wd'msgs' and/or wd'setinvalid' and/or glpaint, otherwise
the repaint will not happen and the screen will turn blank.
--- David Porter <aaadjp at comcast.net> wrote:
> Thanks to all for the suggestions. For my purpose, that is, the purpose
> of the end-user, anything short of a button on the same form would be
> too "disconnected" to be really useful. However, these are all great
> ideas for MY use while developing the code.
>
> It is a truly wonderful thing to be able to sit at the same table with
> all this talent!
>
> Thanks again,
> Dave
>
> Eric Iverson wrote:
> > As several members have pointed out J is single threaded (in
> > particular the J GUI and Engine run in the same single thread). The
> > suggestions of semaphore and mapped files are perhaps more complicated
> > than what you required.
> >
> > At the start of you run delete a known file (e.g.,
> > ~temp\interrup_run). And then test for the existance of that file at
> > appropriate points in the running application (e.g., at the top of the
> > main loop). If the file exists you can then do whatever you want
> > within the application (e.g., use wd'mb ....' to put up a message
> > asking what the user wants to do).
> >
> > ----- Original Message ----- From: "David Porter" <aaadjp at comcast.net>
> > To: "J programming list" <programming at jsoftware.com>
> > Sent: Tuesday, January 15, 2008 8:52 AM
> > Subject: [Jprogramming] Soft-stopping of a long loop
> >
> >
> >> I have a loop that processes around a hundred files. Once started,
> >> it must continue or, you must stop it using one of several ugly
> >> methods from the operating system.
> >>
> >> I put in the break. control word that looks at a variable to enable
> >> a way to break out of the loop. I thought setting that variable with
> >> a button on the form would be a good idea, but all I get when I try
> >> this while the loop is running is the Windows "boink" . Is there a
> >> good, or any, way to set this variable while the loop is running?
> >>
> >> Dave Porter
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
More information about the Programming
mailing list