10-24-2017 03:34 PM
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)
10-24-2017 05:43 PM
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: