i have a tcl script used for test automation (with CarMaker ScriptControl interface)
In the script i am calling a proc where some code is executed that may take a few milliseconds before it returns. However, if at a certain point in this proc it gets called again, the second call will fail and cause an error.
I have no control about when the proc will be called, because the calls come from another application. What i am searching for is a way to prevent a parallel call to the function happening while a certain part of my code is being executed.
Something like this:
proc MyProc {args} {
#Execute Code
set val 0
#---this part should not be interrupt
#Execute non interrupt Code
RegisterQuantities ($names)
Foreach name {
ReadQuantity $name
}
#------------------------------------
return val
}
The calls come from a realtime PC that