canceling a "wait with messages" call...

Dave Cragg dave.cragg at
Wed Aug 29 13:50:17 EDT 2007

On 29 Aug 2007, at 18:10, Andre Garzia wrote:

Hi Andre

> tricky newbie question here. I have a handler which is a looper. It  
> will
> loop downloading files from a queue. It uses a line:
>     wait while lCurrentFileStatus is empty with messages
> to let the handler block (but not the application) till the  
> download is
> complete or blocked. Tricky thing is, if you simply unplug the network
> during the FTP file transfer, revolution is giving no error, it  
> waits and
> blocks forever until you abort with CMD+. when it promptly sends  
> the expect
> "error" message back to the handler.

I don't exactly follow the details of your problem, but I'm guessing  
this is a general gotcha when using libraries that use "wait ... with  
messages" or "wait for messages" to implement asynchronous behaviour.  
As you can imagine, libUrl is full of this stuff.

When you implement a sequence of "wait ... with messages", they have  
to "unblock" in the reverse order they were used. So assuming you  
made a number of libUrl calls (vial load url, for example), and then  
used the above line, the "waits" inside libUrl won't unblock until  
the above wait unblocks. It's easy to get into an eternal wait. The  
general rule is not to use "waits" of any kind while a library (or  
any other routine) that uses asynchronous "waits" is running.

Possible ways to avoid using "waits".

-- rely on the callback message of "load url" to set things
-- use "send ... in ...."
-- use script-blocking calls (get url)

Sorry if I've missed the point entirely. :-)


More information about the use-livecode mailing list