LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
Guy Drew

Default Setting of Call Library Function Thread

Status: Declined
Default setting of Run in any Thread was chosen because most people who inherit a dll don't know if it is thread safe or not. Running a dll in the UI thread will keep it single threaded and will help skirt crashes if it is not thread safe.

Over the years I’ve created a lot of LabVIEW DLL’s for various projects and use DLL’s for different reasons. It took me awhile to figure out why some of my applications were jerky and sluggish. The reason was the DLL’s were running in the UI thread. After changing the thread setting to run in any thread my problems went away. I found in the literature that when the DLL’s runs in any thread it runs in the calling VI’s thread. Is there a reason the default thread is the UI? I would like to see the default thread be changed to “Run in any thread”.

 

Call Library Function Thread.PNG

3 Comments
G-Money
NI Employee (retired)

A lot of people don't write proper thread safe dlls. Running it just in the UI, which is single threaded, will help prevent unsafe swaps that can crash the whole application. I am of the opinion to the leave default as Run in UI thread so that the majority of people that don't know if their dll is thread safe or not will be protected.

Guy Drew
Member

Now I understand the reasoning. It is probably best left alone. It’s only one mouse click.

G-Money
NI Employee (retired)
Status changed to: Declined
Default setting of Run in any Thread was chosen because most people who inherit a dll don't know if it is thread safe or not. Running a dll in the UI thread will keep it single threaded and will help skirt crashes if it is not thread safe.