LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RE: local variable cross-talk?

This facility is actually very useful, for instances where you want to
encapsulate some code so that it can only run in one place at a time, i.e.
global arrays that are written to in more than one place. This method can
eradicate race conditions completely for example when used like this. There
are multiple other uses as well.

However, using a vi as a module of code, to run in more than one instance at
a time simultaneously, re-entrant is the way to go. Just make sure you
debug it first!!!
Remember though, just because a vi may be re-eneterant, doesn't mean that
everything inside is; sub-vi's, Globals etc. The classic one I've seen is
where people think that a re-enterant vi is talking to it's own copy of any
Globals used within it, i.e. counters etc., where in actual fact of course,
they are all using the same Globals.

Worth playing with a few examples to get familiar with it.

Tim Price


This e-mail, its content and any files transmitted with it are intended
solely for the addressee(s) and are confidential and may be legally
privileged. Access by any other party is unauthorised without the express
prior written permission of the sender. If you have received this e-mail in
error you may not copy, disclose to any third party or use the contents,
attachments or information in any way. This e-mail has been prepared using
information believed by the author to be reliable and accurate





> -----Original Message-----
> From: comp.lang.labview@omigatech.co.uk
> [mailto:comp.lang.labview@omigatech.co.uk]On Behalf Of Jeffrey W
> Percival
> Sent: 27 November 2001 20:22
> To: comp.lang.labview@omigatech.co.uk
> Subject: Re: local variable cross-talk?
>
>
> Greg McKaskle wrote:
>
> > I didn't look at the VIs, so I might still be missing something. It
> > seems that you probably have not marked C as being
> reentrant. Note that
> > reentrant VIs do not have a very useful panel for display
> or debugging,
> > but they will perform things like counting and other state
> data operations.
>
> This suggestion worked. I marked the subVI re-entrant, and
> now its multiple
> instances act without interaction. Thanks very much, Greg.
>
> By the way, this situation really floored me... of what
> possible use are
> subVI's if multiple instances don't keep out of each other's way?
>
> --
> ---
> Jeffrey W Percival, Senior Scientist and Associate Director
> Space Astronomy Laboratory, University of Wisconsin - Madison
> 1150 University Ave, Madison, WI 53706 USA
> 608-262-8686 (fax 608-263-0361) jwp@sal.wisc.edu
http://www.sal.wisc.edu/~jwp
0 Kudos
Message 1 of 2
(2,252 Views)
Another useful reply! What a great news group this is.

One last thing I wanted to ask about, though, is global vs. local. I see you
talk about globals, but in fact the variables in my subVI's were locals. I can
easily understand the behavior I observed accompanying the use of global
variables, But I guess the use of the word "local" stumped me.

Should I interpret "local" in LabVIEW's sense to mean "local to all instances
of this VI"? And global to mean "visible to all instances of this VI as well
as other VI's"?

-Jeff


Tim Price wrote:

> This facility is actually very useful, for instances where you want to
> encapsulate some code so that it can only run in one place at a time, i.e.
> global arrays that are written to in more than one place. T
his method can
> eradicate race conditions completely for example when used like this. There
> are multiple other uses as well.
>
> However, using a vi as a module of code, to run in more than one instance at
> a time simultaneously, re-entrant is the way to go. Just make sure you
> debug it first!!!
> Remember though, just because a vi may be re-eneterant, doesn't mean that
> everything inside is; sub-vi's, Globals etc. The classic one I've seen is
> where people think that a re-enterant vi is talking to it's own copy of any
> Globals used within it, i.e. counters etc., where in actual fact of course,
> they are all using the same Globals.
>
> Worth playing with a few examples to get familiar with it.
>
> Tim Price

--
---
Jeffrey W Percival, Senior Scientist and Associate Director
Space Astronomy Laboratory, University of Wisconsin - Madison
1150 University Ave, Madison, WI 53706 USA
608-262-8686 (fax 608-263-0361) jwp@sal.wisc.edu http://www.sal.wisc.edu/~jwp
0 Kudos
Message 2 of 2
(2,252 Views)