canceling a "wait with messages" call...

Andre Garzia andre at andregarzia.com
Wed Aug 29 13:10:40 EDT 2007


Hello Friends,
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 can't wait till the user aborts the
call, it's not polite, so I've used another handler running in parallel with
this one which is a timeout handler.

My first option was, if the timeout handler triggers, then I set the script
local variable lCurrentFileStatus to some non-empty-but-error value and the
looper handler would unblock itself and continue processing. This didn't
work, I don't know why, this is the expected behaviour. A script local
variable is used as flag and one handler blocks waiting for other handler to
work with it. It works like a charm if the download goes okay, the message
sent to the callback handler changes this script local variable and the
handler unblocks.

If there's no network and my own timeout handler tries to set this variable
to something, the handler does not unblock, instead of debugging libURL or
Rev Engine or wherever the problem is, I am now trying to cancel the blocked
handler. I though it would appear in the pending messages, but it does not.
So the question is, how do I cancel a blocked handler?

Cheers
andre



More information about the use-livecode mailing list