LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Interfaces and Reentrancy

Solved!
Go to solution

I am working on a HAL. Which Reentrancy would you use for abstract VI's that I define in a interface for oscilloscopes or data acquisition devices generally?

Quiztus2_0-1717593287682.png

Assuming I have more than one device inheriting from IScope, acquiring data in the same test. Which Reentrancy setting would you choose? I tend to Shared clone reentrant execution.

Actor Framework
0 Kudos
Message 1 of 6
(498 Views)

That sounds reasonable

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 6
(462 Views)
Solution
Accepted by Quiztus2

As a general rule, there's a short decision tree you can make that answers this:

 

Are you running on a "Real-time" operating system?  If so, use Preallocated.

Are you running code where an execution time improvement of microseconds per call will be noticeable and you have plenty of RAM and time before starting execution to allocate it?  If so, use Preallocated.

If neither of the above apply but you need to call more than one copy of the VI at a time, use Shared clone.

 

 

0 Kudos
Message 3 of 6
(432 Views)

It seems you cant use Preaalocated with dynamic dispatch

Actor Framework
0 Kudos
Message 4 of 6
(422 Views)

@Quiztus2 wrote:

It seems you cant use Preaalocated with dynamic dispatch


Correct - pre-allocated means you know what VI you will be calling at compile time (static dispatch), when the whole point of dynamic dispatch is that you will only know at run-time (and thus can change behavior dynamically).

Message 5 of 6
(418 Views)

@Quiztus2 wrote:

It seems you cant use Preaalocated with dynamic dispatch


Oh man, this is a discussion for another day but....

Technically, it would be possible if we could define classes to not allow run.time loading of new classes which inherit from them. Similar to a "final" or "sealed" setting from other languages. That way, the scope of the inheritance tree would be finite at compile time.

 

How do I know it would work? LabVIEW FPGA does it (with one extra caveat). I wish this would be possible outside of FPGA. The ease of coding with objects but the performance of inlined code..... chefs kiss....

0 Kudos
Message 6 of 6
(388 Views)