NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

MainSequenceResults not completed on ReportResult in threaded subsequence

Hi,

 

I am using Record Result properties in order to retrieve some informations in the TestReport that is feed by MainSequenceResults container.

 

 

It works well even in subsequence until I declare this subsequence as 'threaded subsequence'.

 

Have you got an idea why MainSequenceResults don't have informations in this case.

 

I have seen the following link but potentially I launch N threaded subsequence from loop for. In order to wait I am using Wait for all Rendez vous "tag all thread launched"

 

Do I have to continue to use this method and insert wait for thread as link explain at the end of calling sequence.

0 Kudos
Message 1 of 4
(4,285 Views)

First of all, your terminology does not match the terminology used in TestStand. What is a "MainSequenceResults"?

 

You already provided the link explaining why the subsequence does not pass its local ResultList to the caller in case you configured the sequence call to be "New Thread".

But i doubt that you did take a look into the Community Example linked in the bottom of that KB....

 

Two remarks:

- A Rendezvous is the wrong type of step for this. Use "Wait" as the example shows.

- Be careful that there is a huge difference in the setting "New Thread" vs. "New Execution" in the sequence call. "New Execution" will not work as you expect.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 4
(4,255 Views)

Ok I forgot RendezVous.

So if I do multiple call of same threaded method in a loop, the solution explained in the link does not match.

 

My actual code

 

Create RendezVous(foo)

For      NThreadedLaunch

           call     mySubSequence                         NewThread

EndFor

Wait For All (foo)

 

 

For      NThreadedLaunch

           call     mySubSequence                         NewThread

           Wait             Thread(mySubSequence

EndFor

 

 

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

@niva wrote:

Ok I forgot RendezVous.

So if I do multiple call of same threaded method in a loop, the solution explained in the link does not match.

 

My actual code

 

Create RendezVous(foo)

For      NThreadedLaunch

           call     mySubSequence                         NewThread

EndFor

Wait For All (foo)

 

 

For      NThreadedLaunch

           call     mySubSequence                         NewThread

           Wait             Thread(mySubSequence

EndFor

 

 


Perhaps what you want is:

 

For Loop

     Call sequence in a new thread

End

 

For Loop

     Wait for previously called thread

End

 

If so, you can do something like this:
 

1) Create a local variable that is an array of Object References to store the thread references. For Example: Locals.myThreads. Before your sequence call loop, do something like SetNumElements(Locals.myThreads, Locals.numThreadsToCreate)

2) In the advanced settings panel for the sequence call step use an expression like the following for the "Store an Object Reference to the Thread" setting:

Locals.myThreads[Locals.myLoopIndex]

3) For the wait step, use the "Specify by Object Reference to the Thread" option and specify an expression like the following:

Locals.myThreads[Locals.myLoopIndex]

 

Hope this helps,

-Doug

0 Kudos
Message 4 of 4
(4,234 Views)