NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication between threads

I have two operations which can proceed independently, so I have one going in a different thread.

 

Rarely a situation arises when I need to issue the unit under test a command that would impact the other thread. I would like to make sure the other thread is finished before doing this.

 

Is this information available?

 

I'm using TS 2013 in sequential mode.

0 Kudos
Message 1 of 4
(3,031 Views)

Is this how it's typically done? Seems simple enough to write to a file global variable in the thread being monitored, and then query its status from the other thread:

 

thread_completed.png

0 Kudos
Message 2 of 4
(3,015 Views)

That's a completely valid option, but i'd argue a notification is a more elegant solution. Aside from just checking the notification periodically, this gives you the option to wait on it. You also get a few other nice freebies, like being able to check the number of threads waiting, or being able to send some data that describes the state of the thread.

 

Either way, you should be using termination monitor so your sequence doesn't hang if someone terminates the execution.

 

Hope this helps!

Trent

https://www.linkedin.com/in/trentweaver
0 Kudos
Message 3 of 4
(3,007 Views)

Thanks for the suggestion. I'll dig into that some more.

0 Kudos
Message 4 of 4
(2,968 Views)