Synchronization Step Types - Queue

TestStand 2019 Help

Edition Date: May 2019

Part Number: 370052AA-01

»View Product Info
Download Help (Windows Only)

Purpose

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


Open Example

<TestStand Public>\Examples\Built-In Step Types\Synchronization Step Types\Synchronization Step Types - Queue.seq

Highlighted Features

Major API

None

Prerequisites

None

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.

  1. Select Edit»Sequence File Properties to launch the Sequence File Properties dialog box.
  2. On the Sequences pane, select the MainSequence.
  3. Complete the following steps to review the steps in the MainSequence.
    1. 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".
    2. 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.
    3. 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.
    4. 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.
    5. 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.

  1. Select Execute»Single Pass to run the sequence.
  2. Read the text in each section popup message for information about the behavior of that section.

WAS THIS ARTICLE HELPFUL?

Not Helpful