LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XControl shared subVIs

I was trying to find a knowledge base on here for developing XControls, but could not find what I was looking for.  I inherited an application that contains several different XControls, some of which have 12-15 instances.  I'm experiencing occasional freezing and crashing of the application that I suspect could be do to the XControls because the crashes typically occur when clicking on a Front Panel control that is part of one of the XControls.  

 

I think I recall it being a no-no to use subVIs (non-reentrant subVIs) in an XControl (Facade VI specifically) that are also being called from other parts of an application.  My guess/recollection is that since the XControls run in the UI Thread, this could force all instances of the subVIs they use to execute in the UI Thread as well.

 

Could my XControl experts out there chime in on this topic or confirm my suspicions?

 

thanks in advance,

Q

0 Kudos
Message 1 of 2
(2,083 Views)

Q,

 

i wouldn't say that using non-reentrant shared subVIs in XCtrls is really a "no-no", but it is not recommended. The reason is that this could effect execution of the application, esp. when using several XCtrl instances.

Depending on the average exeuction times of these subVIs it really comes to a no-no if it is a long execution.

 

Hangs shouldn't occur except you have blocking calls for several seconds/minutes.

 

Usually, the execution of a subVI is "same as caller". So even if the XCtrl executes the subVI in the UI Thread, it does not imply that every other caller executes it in the UI Thread as well. The only part shared between non-reentrant subVI calls is the data space. The functional code can be "stored" in different threads depending on the callers setup. But all those access the same shared data space. That is why non-reentrant subVIs block each other (lock functionality).

 

Rule of Thumb:

Do not use shared non-reentrant subVIs in XCtrls except the execution of each call is very short and the shared data space gives you great advantages compared to the possible draft back of blocking each other. If you don't need the shared data space, make the subVI reentrant.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 2
(2,062 Views)