06-13-2011 06:29 AM
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!
06-13-2011 05:04 PM
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.
06-14-2011 08:35 AM
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!
06-14-2011 08:58 PM
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.
06-15-2011 12:51 AM
Thanks,
If the new dll then raise an event when the call to the original dll is finished it may work.