SyntaxWhen such a program is first executed in a session, a pool of Tcl interpreters is initialized, one of which is allocated for the executing code. When the code is completed, the interpreter is freed up. Subsequent Tcl code that is executed in a pooled program during the session will use an interpreter from the already initialized pool. When programs are created, the default is that they are not pooled. To define or modify an MQL type program to use the pool of interpreters, use the following syntax: mql< > add|modify program PROG_NAME [!]pooled; The “!” can be used to turn off the pooled setting of a program.
The number of interpreters available in a session is controlled by the
UsageEnabling the Tcl interpreter benefits MQL/Tcl programs that are nested or run in a loop, such as the trigger manager. Unexpected results could occur if the pooled setting is turned on in a program without first reviewing and validating its code. Good programming techniques must be adhered to ensure proper results. When using an interpreter pool, Tcl variables are not cleared before freeing up an interpreter. This means that programs must explicitly set variables before using them, in case a previously executed program made use of the same variable name. External, downloadable and Java programs do not use the Tcl interpreter pool, regardless of the setting in the program definition. In addition, MQL/Tcl programs that use the TK toolkit will not benefit from using the pooled setting, since user interaction is required. In fact, unexpected results, such as leaving a TK dialog displayed, might occur due to the use of variables as described above. Before modifying existing programs to use the pooled setting, the code should be reviewed and validated. Only programs that include tcl code but no TK code should use the pooled setting. |