LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Thread Communication

Hi,

I am trying to do some multithreading within ma application but I have no clue how I can do it with LabView.

I want to have three threads in my program.

The first one is the controller thread which decides which of the other threads should start.
I know how to do this. (each loop is waiting for an input value and only the chosen loop is getting it)

But my problem is stopping a thread.

Actually stopping it is possible via a flag value, but actually I want to kill it, as my application is time critical and sometimes I can't wait for a thread to finish by itself.

Is there a way to kill threads?
Is there another way to implement continously running threads than a while loop?

Thanks,
Bernie
0 Kudos
Message 1 of 5
(3,344 Views)
LabVIEW takes care of all the threading, so it is not really possible to declare a thread here and there. There is a good chance that inside of your loops LabVIEW has declared new threads for you. So in LabVIEW you either run single threaded or allow it to create them when it sees fit. LabVIEW is good at handling the threading, and I have not run into any problems with it.

But that doesn't answer your question so what I suggest is using named timed loops. A timed loop is similar to a while loop, however timed loops have a scheduler, name, and priority. So what you can do is name all the loops, and set their priorities periods etc. Then you can trigger each loop however you would like, I suggest notifiers personally, because the wait on notification sleeps. Then if you ever want to abort a loop you can call abort on the loop, which should stop it, and you can continue on.
0 Kudos
Message 2 of 5
(3,341 Views)
Thanks for that fast answer! And I have to say it sounds perfect.

I have just one problem with it.

I have created the timed loop and I am trying to start and stop it from another loop.

Stopping works fine using the Stop Timed Loop.vi, but controling the start gives me a headache.

I have tried to use notifiers and also the synchonized timed loop start vi, but I did not get it working.

Can you give me a short example of one loop starting another loop?

Thank you very much,
Bernie
0 Kudos
Message 3 of 5
(3,333 Views)
Take a look at this and let me know if it does what you where thinking.
Message 4 of 5
(3,330 Views)
Thank you very very much!

Now I understand the timed loop and notification thing.

Have a nice day,
Bernie
0 Kudos
Message 5 of 5
(3,316 Views)