The start_waitable_operation
command returns a unique operation handle, which can be passed to the following command to
obtain the results of the operation:
wait_for_operation operationHandle
This function will return the results of the operation in the following formatted string:
status returnValue1 [returnValue2 [returnValue3 [...]]]
The status field will contain one of the following:
This is returned if the operation has completed without any errors, and the return arguments are valid.
This indicates that an update from the operation has been received. There may be arguments that can be used as intermediate results (e.g. for graphing individual points as the operation proceeds). The update message may also be used as a trigger to perform another operation.
A status of update indicates that the operation is not yet completed. It is
necessary to issued the wait_for_operation
command again until the
status changes to normal.
Any string other than normal or update in the status field indicates that an error has occurred in the operation.
The wait_for_operation
command will return a TCL level error which must be
caught (using the TCL catch command) if the script writer intends to do any clean up.
If the error is not caught, the currently running operation or scripted device will return
an error condition.
See Exception handling for details on handling errors.
It is not necessary to worry about the exact timing of the wait_for_operation
command. If
the wait_for_operation
command is issued after the operation has already completed, the results
of the operation will be returned by the scripting engine immediately. If the command is issued before
the operation is completed, the script will hang until the operation is completed or the operation sends
an update
message.
Example: Waiting for the results of the optimize operation
set opHandle [start_waitable_operation optimize table_vert i2 20 0.05 0.1] set result [wait_for_operation $opHandle] log_note $resultoutput: normal 30.774772