LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you garantee thread calling DLL other than UI thread

I have a DLL which is not thread safe (it uses some resources tied to the threadID). Calling this DLL one could use the UI-thread, of course. But then the DLL hogs up the UI thread which is not what I want.

 

So the question is: if I never call the DLL from any other VI, and always call the VI containing the DLL call once, is there any way to garantee that it is always run in the same thread? (Same thread of course per application run)

 

 

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

You can wrap all the calls to the DLL in subVIs, set those subVIs to execute in a dedicated execution system and priority, and then configure that particular execution system and priority combination to use only one thread, by launching the threadconfig VI mentioned at the end of this article: http://digital.ni.com/public.nsf/allkb/84ECA015AA496B23862565BC006C0F19

That tool will write lines to your labview.ini file; you can copy those same lines to the ini file for an application that you create, if you're building an application from your code.

 

Alternately, you could modify your DLL with the changes suggested here:

https://forums.ni.com/t5/LabVIEW/Force-DLLs-to-tun-in-the-same-thread-expect-the-UI-Thread/m-p/11454...

Message 2 of 2
(2,749 Views)