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

Home » Public Forums » archive » endless loops suck
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: endless loops suck [message #33891 is a reply to message #33853] Tue, 04 February 2003 13:12 Go to previous messageGo to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"Altyntsev Dmitriy" <alt@iszf.irk.ru> wrote in message
news:6b9fda50.0302040226.319c7487@posting.google.com...
>
> [ Discussing on how to make IDL code interruptible under Windows ]
>
> Instead of "print", TMP = WIDGET_EVENT(/NOWAIT) can be used. It
> forces IDL to process Windows events including break events and
> events that were sent to IDL by other applications. It allows other
> applications continue to work and makes the work on Windows
> "smoother" while IDL is running.

Very nice! For many years now I have used a "yielder widget" for this
purpose (David's progress bar widget will also do) but I have always
wanted a more lightweight, less visually obtrusive method. I always
thought you needed to feed a valid widget ID to WIDGET_EVENT!

Just a couple of extra comments, based on experiments on my system
(IDL 5.6, Win 2000, Pentium 2 800 MHz)

This is interruptible

while 1 do begin & tmp = widget_event(/NOWAIT) & endwhile

but this is not (so don't try it at home)

while 1 do tmp = widget_event(/NOWAIT)

In other words, as proposed by David, the begin and end do matter. I'm
sorry for doubting you, David!

The overhead for calling WIDGET_EVENT is small, about 5.5 microseconds
(cf 39 nanoseconds per iteration for an empty for loop).


--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: OPENW and environment variables in IDL 5.5
Next Topic: Re: Test if variable is a string

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

Current Time: Fri Oct 10 11:13:46 PDT 2025

Total time taken to generate the page: 1.51358 seconds