LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Call a .net assembly from multiple threads

I need to make call to a .net assembly from several threads in parallel. Now I noticed that CVI do not support this, as stated in the ".NET Library Overview" article (http://zone.ni.com/reference/en-XX/help/370051T-01/cvi/libref/cvidotnet_overview/)

"Calling .NET methods in different threads happens serially"

 

Is there a way around this?

Please help!

 

0 Kudos
Message 1 of 5
(3,529 Views)

You can call .NET methods from multiple threads in your CVI programs. If one of the .NET method calls blocks or waits for a long time, then .NET calls from other threads will wait until the first call returns. Currently, there is no way around this in the CVI .NET library. If some of your .NET calls can block or wait for long durations then one possibility is to multithread your .NET calls in a new .NET DLL and then call that from CVI.

0 Kudos
Message 2 of 5
(3,516 Views)

thanks for the reply,

Yes, this is exactly how it is, sometimes the .net assembly responds quickly and the other threads running as expected, but some calls to the .net assembly needs longer time to respond (minutes) and then the other threads tend to freese!

 

does it really make any differance to load the same .net dll with different name, and for each thread! however that will messup the code a lot! Smiley Happy

 

 

0 Kudos
Message 3 of 5
(3,506 Views)

No, loading the .NET assembly (DLL) with different names in each thread will not help. One way around this is to write another .NET assembly (DLL) which spawns the threads and call this new assembly from your CVI code.

0 Kudos
Message 4 of 5
(3,500 Views)

Thanks,

If the new dll then raise an event when the call to the original dll is finished it may work.

0 Kudos
Message 5 of 5
(3,494 Views)