LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to manage threads in LabVIEW or have exclussive access to a thread

Hi!

 

For our application we need to ensure that our function (a .NET external .dll) is run on the same thread and no other process may be executed in parallel on it. In other words we need an exclusive Windows thread that is not used for anything else.  Is there any way to manage that in LabVIEW like it is possible in other programming languages (ex. .NET : https://learn.microsoft.com/en-us/dotnet/api/system.threading.thread?view=netframework-4.8.1)?

 

One thing that we tried was to use a timed sequence function that should use a new thread for the functions that run within it, but a recent bug proved that this solution that does not ensure that the thread is used exclusively there.

see https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000ozAeCAI&l=en-US that mention the fact that timed structure spawn a unique thread per structure:

"There are several ways to achieve a unique thread that can be elevated. Placing code in a unique thread would allow the ability to spawn code, elevate, perform action and then de-spawn code and thread.

  • Timed structures spawn a unique thread per structure. "

 

Thanks in advance for all the LabVIEW expertise!

0 Kudos
Message 1 of 2
(1,176 Views)

There is no simple way to ensure that in LabVIEW, since LabVIEW multithreading is very well hidden and automanaged to not have users have to worry about it. The easist thing I could imagine right now would be to actually use .Net as you elude in your own message. And for that you should almost certainly create your own external assembly that initializes a thread and executes an Executer that you can command to run your functions in.

 

It's not trivial I know but LabVIEW multithreading is carefully shielded from the user because 99% of the users have no idea how to deal with multithreading and almost always make things worse by trying to fiddle with the settings. 

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 2
(1,130 Views)