02-09-2017 12:33 PM
I'm using TS 2014 SP1 and here's what I'm running into and need help on.
I have a main sequence that spins off a new thread. The new thread generates a freq from NI card and it runs in the background for 2 seconds. This sequence needs to be running in order for the main sequence to read the freq that's being generated in the new thread. Once the freq is read, I "unload" the step that produces the new thread by using unloadmodule() step. I put in a wait for 2 seconds and then we move to the next channel and repeat the above steps. The wait step was to make sure the new thread stopped executing before moving to the new channel. Each channel has a different frequency we test.
Problem: While i'm able to read the right value most times, I occassionally get a value of 0. I believe it's becuase of a synchronization issue. Either the thread isn't stopping or there is a miss in the handoff value and it ends up being 0.
Any example to show how this can be done will be appreciated!
02-09-2017 04:07 PM
Why does it need to be spun off in a new thread? Just call it and have it return the value if it is only 2 seconds.
02-10-2017 03:00 PM
@~jiggawax~ wrote:
Why does it need to be spun off in a new thread? Just call it and have it return the value if it is only 2 seconds.
B/c MihirKiran needs to generate, and measure at the same time - so parallelism is needed.
@MihirKiran wrote:
The new thread generates a freq from NI card and it runs in the background for 2 seconds. This sequence needs to be running in order for the main sequence to read the freq that's being generated in the new thread.
I propose two ways, and one comment.
Comment: you don't need to do step unload. This is just overhead. You should implement code module in a way, that it will simply stop execution, when generation is finished.
02-13-2017 10:11 AM
I'll need to generate and measure at the same time.
02-13-2017 10:12 AM
thank you kosist90! The screenshots are very helpful. I'll try it out in my code and see if that resolves my issue! 🙂