NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Sharing FileGlobals in Batch Mode

Hello,
 
    I am trying to share a variable across multiple UUTs (threads) in a test sequence that is run using a batch test mode. I planned to use a FileGlobal variable to do this, however I noticed some interesting behavior when I put together a test sequence to try this out. The interesting behavior I saw was that the FileGlobal variable did not get updated in both threads unless I enabled the "PropFlags_Shared" property of the variable. I had assumed that a FileGlobal variable (without needing to set the PropFlags_Shared property) should have worked fine, since it is a "FileGlobal". 
    I've enclosed a simple file to show you what I am seeing. The test file includes 2 FileGlobal variables, SharedGlobal and DefaultGlobal. The SharedGlobal variable has the PropFlags_Shared enabled, while the DefaultGlobal does not (i.e. default - no property flags are set). There are 2 steps in the sequence that change the values of the variables. These steps use precondition statements so that a specific test socket changes the values. When the sequence is run, the SharedGlobal variable's value will change in both threads, however the DefaultGlobal will only change in the thread that changes it. NOTE: Set the Sequence Editor Model Options - Number of Test Sockets to 2, prior to running the sequence.
   So my question is, why do I need to enable the PropFlags_Shared property of a file global variable to share its value across multiple thread (i.e. sockets), versus not setting this property in a default mode file global variable? Am I missing something?
 
Thanks in advance for yor help,
Jim
0 Kudos
Message 1 of 4
(3,263 Views)
The default behavior is that each execution will have it's own copy of the sequence file globals. You can go to Edit>Sequence File Properites and change it to shared.
0 Kudos
Message 2 of 4
(3,262 Views)
This is probably confusing because the Batch and Parallel process models create a new Execution for each test socket although you might reasonably imagine they would just create a new Thread for each socket.
 
The models create Executions instead of Threads so that the test sockets can terminate and restart independently.
0 Kudos
Message 3 of 4
(3,256 Views)

Gentlemen,

   Thank you for your responses and helping me to understand this better.

Thanx,

Jim

0 Kudos
Message 4 of 4
(3,252 Views)