TestStand 2019 Help
»View Product Info
This example demonstrates how to use the Queue synchronization step in a sequence file that uses the Batch process model. You can use a Queue step to pass data between threads or across executions while avoiding race conditions.
Example File Location
<TestStand Public>\Examples\Built-In Step Types\Synchronization Step Types\Synchronization Step Types - Queue.seq
How to Use This Example
The Queue step is similar to a Notification step in that you can send data between multiple test sockets. Queue steps can contain multiple data values. This example demonstrates how to complete the following tasks for a queue:
- Enqueue—Add an element to a queue.
- Dequeue—Remove an element from a queue or store the data from the element.
- Get Status—Obtain information about the current state of the queue.
- Flush—Empty the queue and optionally obtain all the elements from the queue.
Complete the following steps to review the sequence functionality.
- Select Edit»Sequence File Properties to launch the Sequence File Properties dialog box.
- On the Sequences pane, select the MainSequence.
- Complete the following steps to review the steps in the MainSequence.
- In section one, select the Create Queue 1 step. On the Queue Settings edit tab, notice that the Create operation is selected. This step creates a new queue named "Queue 1".
- Select the Enqueue One Element sequence, then select the Enqueue Data step. On the Queue Settings edit tab, notice that the Enqueue operation is selected. This step adds a new element, the value of the Locals.EnqueueData variable, to the queue.
- Select the Dequeue Data step. On the Queue Settings edit tab, notice that the Dequeue operation is selected. This step removes an element from the queue. If the queue is empty, the step waits until data is available to dequeue, as shown in section two.
- In section three, select the Get Status step. This step uses the Get Status operation places the current contents of the queue into the Locals.QueueStatus variable without modifying the state of the queue.
- Select the Flush Queue step. On the Queue Settings edit tab, notice that the Flush operation is selected. This step removes all data from the queue. TestStand places the data in the location specified in the Location to Store Array of Queue Elements control. In this case, TestStand places the data in the Locals.FlushedQueue variable.
Complete the following steps to run this example.
- Select Execute»Single Pass to run the sequence.
- Read the text in each section popup message for information about the behavior of that section.