ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

取消
显示结果 
搜索替代 
您的意思是: 

DLL call slows down user interface

已解决!
转到解答

Hi

 

I am working on a simple temperature DAQ application, using the pico TC-08 8-channel temperature device. Through USB.

I use the pico .dll to setup and read the channels.

This works, so far so good.

 

But when I run this in a loop, where I wait 1 second between reading the channels, the front panel controls are slowed down significantly.

All user interface seems to be ignored as long as the dll is working on the measurements.

I.e. when I click increment or decrement buttons on a numeric control, there is significant delay.

 

Screenshot of test app is attached.

 

The question is:

Why does the dll call make the user interface slow?

 

br

Kaare

0 项奖励
1 条消息(共 6 条)
2,413 次查看
解答
已被主题作者 KaareBK 接受

That dark orange background of the call library function node (CLFN) says to me that the dll is running in the UI thread, which would slow down the rest of your front panel. Open the CLFN and configure it to run in any thread

 

thread_help.png

 

clfn_config.png

2 条消息(共 6 条)
2,392 次查看

Brilliant DHerron !

That solved it.

 

Thanks !

Kaare

0 项奖励
3 条消息(共 6 条)
2,383 次查看

@DHerron wrote:

That dark orange background of the call library function node (CLFN) says to me that the dll is running in the UI thread, which would slow down the rest of your front panel. Open the CLFN and configure it to run in any thread

 

thread_help.png

 

clfn_config.png


I feel we would be remiss if we didn't stress the caveat about being called from multiple places.  DLLs run in the UI thread by default so all calls are serialized.  Since dlls usually don't usually expect to be called from different places at the same time, you have to make sure it's okay to do so, and by running the dlls in the UI thread, this is guaranteed.

So how do you know if it's thread safe?  Usually, not even the dll provider knows, so it's usually about just doing it and watching for strange behavior or even crashes.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
4 条消息(共 6 条)
2,378 次查看

@billko wrote:

...by running the dlls in the UI thread, this is guaranteed.

So how do you know if it's thread safe?  Usually, not even the dll provider knows


It would be nice if LabVIEW supports creating a dedicated (non-UI) thread for calling a particular DLL's functions.

 

A well-designed library should document which functions are thread-safe and which aren't. (Unfortunately, not all publicly-available DLLs are well-designed)

Certified LabVIEW Developer
0 项奖励
5 条消息(共 6 条)
2,285 次查看

@JKSH wrote:

It would be nice if LabVIEW supports creating a dedicated (non-UI) thread for calling a particular DLL's functions.

 

A well-designed library should document which functions are thread-safe and which aren't. (Unfortunately, not all publicly-available DLLs are well-designed)


 

Open an idea on the idea exchange.

0 项奖励
6 条消息(共 6 条)
2,265 次查看