Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

timing issues between tcl and C

Status
Not open for further replies.

erae

Programmer
Jan 21, 2005
1
US
Dear tek-tips,

I'm sorry I am very much a beginner with tcl and scripting in general.

I am working with a program, written with C++ and tcl, which opens a modified tcl shell when it runs. I can change variables, and execute functions in the C++ program by typing tcl commands at the prompt.

The problem is this: I would like to execute a function repeatedly, changing some variables with each iteration.

This code sort of works:

set myvariable 0

for {set i 1} {$i < 10} {incr i 1} {
myfunction execute
after 5000 {set myvariable $i}
vwait myvariable
}

However, the timing is not always right. I would like for myfunction to finish executing before myvariable is reset and the loop is repeated.

I hope this makes sense!

Thanks for your help,
erae

 
Two ideas.

One: use trace on a global variable that is changed by
myfunction to determine procedure execution.

Two: use an internal loop to determine completion of the procedure with a timeout value.
HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top