LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is a call library function node in LabView 8.6 synchronous or asynchronous?

I tried setting a sub-VI with a call library function node in it to "subroutine" execution status.  The error list indicated that the Call Library Function node in the block diagram was an asynchronous node.  The LabView on-line help content indicates

 

"...CINs and shared libraries execute synchronously, so LabVIEW cannot use the execution thread used by these objects for any other tasks. "

 

Does anyone know for sure what the status of a Call Library Function is?  Does it depend upon the specific code in the DLL being called?

 

Thanks,

Mike H.

0 Kudos
Message 1 of 4
(3,004 Views)

Is your DLL call set up for "Run in UI thread" or "Run in Any thread"?  If your DLL is not re-entrant (Run in UI thread) then you're forcing LabVIEW to switch threads to execute it, which makes it asynchronous to the subroutine thread but synchronous to the UI thread.  Changing to "Run in any thread" will remove the error (I just tested it) but could cause you other problems if your DLL is not re-entrant and you call it from multiple places.  To determine if the DLL is re-entrant you'll need documentation or information from the DLL's author or provider.

Message 2 of 4
(2,995 Views)

Based on the help page it looks like it should execute asynchronously.

The thing in the description that leads me to believe they execute asynchronously is that you can configure the library to run as a multi-threaded operation.

 

Please take a look here to see the difference between synchronous and asynchronous execution.

Since the code even has the ability to be multi-threaded, you can consider it as running in parallel to your other code.
Any data returned is passed to the thread that called that function.

Cory K
0 Kudos
Message 3 of 4
(2,992 Views)

Thank you to nathand and Cory K.  I was able to set it as a subroutine by your suggestions.  I will have to experiment with this setting to see if other problems occur based upon the thread or re-entrant capability.

 

Mike H.

0 Kudos
Message 4 of 4
(2,977 Views)