09-13-2006 10:24 AM
09-13-2006 11:55 AM
Hi Neil,
I have used variations on that concept going back to BridgeVIEW 2.1.
Please post your test VI and let us take a look.
I have not tried this with LV 8.X yet and I seem to remeber there may have been some changes that affected this, but I am not sure about thta point.
Ben
09-13-2006 12:37 PM
09-13-2006 12:40 PM
sigh, why do my attachments never work??? I try repost using Internet Explorer instead of Firefox.
ps: I am using LV7.1
09-13-2006 12:41 PM
@nrp wrote:
I have a main GUI, which opens another VI using call by reference. I would like to use a LV2 global to share (read and write) data between both VIs, however it sometimes seems to not work properly (in the second VI the data in the LV2 global is not the same as the data that is set in the main VI). Is it possible to use a LV2 global in this manner?
Could it be that your LV2Global is accidentally set to reentrant execution?
Are you absolutely sure you are using the same LV2 global VI in both locations?
09-13-2006 12:47 PM
09-13-2006 01:44 PM
@nrp wrote:
Do you recommend for/against this type of design pattern?
09-14-2006 02:18 AM
09-14-2006 05:18 AM
09-14-2006 08:07 AM
Hi Neil,
Please see the examples I posted in reply #13 & 14 of this thread.
http://forums.ni.com/ni/board/message?board.id=170&message.id=204323#M204323
Those VI's comprise a very simple example of the "Action Engine" i.e. LV2 with brains.
Any time I have a data structure that must be manipulated from more than one place, I will concider using an Action Engine.
It greatly simplifies the management of shared data structures in what I feel is a very elegant manor.
The Action and LV2 have to be set as NOT re-entrant to work. If they are re-entrant, they can be executed at the same time by more than one caller, and this is made possible by giving each instance a distinct data space. The district data space makes it impossible (?) to share the data across instances.
Now if the VI is NOT re-entrant, they have a single data space for every instance of the VI. This means if I leave some data behind from one, a latter call can get at that data. Now to prevent the wires of a shared non-re-entrant VI form having to hold the values from more than one call, only one of the calls is allowed to execute at anyone time. This is the key to what makes these action engines powerful. LV in the background miantians a set of mutexes to prevent more than one call to take place at any one time. It is this "locking" that helps us prevent race conditions when using action engines.
Enough background ideas!
When designing your action engines, make sure that any manipulation of your data structure takes place inside the action engine. AS long as it is inside the action engine, other attempts to manipulate the data are forced to wait until the previous is complete.
Food for thought:
If you have data structures that are dependant on other data structures, then you can call one action engine from within another action engine.
Done rambling.
I hope some of this helps.
Ben