Using a Spawn Statement

A spawn statement begins execution of the specified statement or block of statements in a new thread. Since the purpose of spawn is to initiate concurrent test operations on multiple machines, the structure of a block of spawned code is typically:

You can use spawn to start a single thread for one machine, and then use successive spawn statements to start threads for other machines being tested. Silk Test Classic scans for all spawn statements preceding a rendezvous statement and starts all the threads at the same time. However, the typical use of spawn is in a loop, like the following:
for each sMachine in lsMachine
  spawn        // start thread for each sMachine
    SetMachine (sMachine)
    DoSomething ()
The preceding example achieves the same result when written as follows:
for each sMachine in lsMachine
    [sMachine]DoSomething ()

To use a spawn statement in tests that use TrueLog, use the OPT_PAUSE_TRUELOG option to disable TrueLog. Otherwise, issuing a spawn statement when TrueLog is enabled causes Silk Test Classic to hang or crash.