NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I close a new thread after starting a sequence in a parallel new thread?

How do I close a new thread after starting a sequence in a parallel new thread? 

I know I can store the new thread object reference on creation but don't know how to release the thread.

0 Kudos
Message 1 of 3
(3,129 Views)

Hi,

 

You are using the sequence call step to launch a sequence in a new thread? You could just let the sequence run to the end and it will close all by itself. If there is a loop in the sequence then you could send it a message to exit and let it close itself. Use a Que or poll a StationGlobal or pass a property as a parameter to poll. You could use an api method on the stored object reference, sorry I don't have TestStand right here to look at it, but you probably would use Thread class methods and properties. Usually this would be abort or something non-graceful like that. I think the best way is to tell the thread to exit and let it jump to its own cleanup and exit itself. You can use a Wait step that will wait on the thread to exit if needed.

cc

0 Kudos
Message 2 of 3
(3,119 Views)

Set the obj to Nothing

 

eg

Locals.SeqObj = Nothing

 

 

Regards
Ray Farmer
0 Kudos
Message 3 of 3
(3,111 Views)