Example Code

CVI Simple Command Line Threading example

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Other

Code and Documents

Attachment

 

Overview
This example passes an array to a thread in CVI that will add five to the given integer and return this value to the calling thread.


Description
This code shows a simplified threading example using the CVI Threading libraries. An Array is passed by reference to the threaded function to show how data can be passed between your calling thread and the newly created function. This is a command line application to further simplify how the libraries can be used. This example is not benefitting from threading because it simply waits for the thread to complete, but is instead intended to show how to start out with usable code. 
Requirements

  • LabWindows/CVI 2012 (or compatible)


Steps to Implement or Execute Code

  1. Open "SimpleThreadingExample.prj"
  2. Run the program
  3. Notice that the thread is called and that the result of adding 5 to 7 is 12.

 

Additional Information or References

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.