Purpose

A TestStand execution cannot break until all threads within the execution have been suspended. If one or more threads in the execution is running a code module, the execution will not break until all code modules complete.

This example demonstrates two methods you can use to override this behavior:

  • The Thread.ExternallySuspended property, which if set to True, allows an execution to be suspended even if the current thread is still executing a code module. You can use this option to configure the execution pausing behavior on a per code module basis.
  • The Allow Break While in Code Modules station option, which allows any execution to be suspended even if one or more threads is still executing a code module. This setting is located in the Execution tab of the Station Options dialog. You can set this option at run-time, as shown in this example.

The example also demonstrates how you can poll the TestStand execution status within a code module and respond when the execution pauses.

Example File Location

<TestStand Public>\Examples\Fundamentals\Pausing Executions with Running Code Modules\CVI\Pausing Executions with Running Code Modules.seq

Highlighted Features

Debugging TestStand Executions

Major API

Thread.ExternallySuspended

Prerequisites

None

How to Use This Example

Complete the following steps to run the example:

  1. Select Execute»Run MainSequence to execute the sequence.
  2. This example shows three configuration cases. For each case, the code module dialog indicates the current settings for the Thread.ExternallySuspended property and the Allow Break While in Code Modules station option.
  3. In case one, observe that the TestStand execution does not pause when it reaches the break step. The code module also continues executing.
  4. After you dismiss the dialog, the execution will pause. Click the Resume button or press F5 to resume the execution.
  5. In cases two and three, the execution is able to pause successfully, and the code module pauses the simulated testing operation. If you resume the execution in TestStand while the module is still running, observe that the module resumes testing.