comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Q: A good way to interrupt and kill procedures?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Q: A good way to interrupt and kill procedures? [message #11629] Fri, 22 May 1998 00:00
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <3564D53A.7B3B970B@astro.berkeley.edu>, Nancy Levenson <levenson@astro.berkeley.edu> writes:
> I am looking for a sensible way to set up a time-consuming program so
> it can be interrupted.
>
> The time-consuming tasks are image manipulations for astronomical data
> reduction. They are run with a widget. Ideally, I would like to have
> a 'kill process' button whose events could be recognized while the
> data reduction is in progress.

Here is an example of how I do that. This is an excerpt from an IDL widget
application which goes into a long loop when collecting data. There is a
ABORT_SCAN button which remains active when the loop is running.

This is the code which causes an event to be generated if that button is
pressed. This is done in the "inner loop" of the scan routine, outside the
context of XMANAGER

; See if an ABORT_SCAN widget event has happened
if (widget_info(sd.abort_scan_widget, /VALID_ID)) then $
event = widget_event(/NOWAIT, sd.abort_scan_widget)

; Has the scan been aborted?
if (sd.abort_scan ne 0) then return

If there is an abort scan event in the event queue, then the above statement
will cause the event handler routine to be called. Here is the code for the
event handler:

pro abort_scan, event
; This routine gets called when the ABORT_SCAN button is pressed
; It sets the abort_scan flag in the scan descriptor, which the scan
; routines look at after each point and abort the scan
@scan_common
sd.abort_scan = 1
end

This event handler simply sets a flag which says that the scan should be
aborted. The scan routine looks at this flag to decide whether
the user wants to abort the scan, and stops the operation if he does.

____________________________________________________________
Mark Rivers (773) 702-2279 (office)
CARS (773) 702-9951 (secretary)
Univ. of Chicago (773) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars.uchicago.edu (e-mail)

or:
Argonne National Laboratory (630) 252-0422 (office)
Building 434A (630) 252-0405 (lab)
9700 South Cass Avenue (630) 252-1713 (beamline)
Argonne, IL 60439 (630) 252-0443 (FAX)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: FORTRAN DLL and CALL_EXTERNAL
Next Topic: Re: FORTRAN DLL and CALL_EXTERNAL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:34:42 PDT 2025

Total time taken to generate the page: 0.00439 seconds