[tkined] after/job in foreach loop creates a loss of program flow?

From: Matthew Levine (mlevine@cisco.com)
Date: Fri Oct 27 2000 - 23:34:37 MET DST


I've been using the after command to implement packet retries and I
noticed that when the after callback executes, I lose my context in the
for loop its in.

A little code might help....

foreach host $hosts {
        set msgid [send_packet $host]
        set rx($msgid) [after $timeout [list send_packet $host]]

On the receive side I cancel the after command when I receive an ack for
the packet I send.

The problem is, if that after callback ever gets executed, I lose my
place in the for loop and send_packet isn't called for the rest of the

I've tried to replace the after code with the job command from Scotty
but get the same result.

Is there a reason why this happens and how I can workaround it?

E-mail responses preferred.


Matthew Levine
Development Test (Consumer Line Of Business)
Cisco Systems, Inc	http://www.cisco.com/
mlevine@cisco.com	(408) 525 - 5431
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.

This archive was generated by hypermail 2b29 : Mon Jan 08 2001 - 15:27:55 MET