Why should you explicitly open and close shared variable connections?

I'm looking into switching over from the old Datasocket API to the new Shared Variable API for programmatic access to shared variables, and I noticed that LV doesn't seem to have any problems executing Shared Variable Reads & Writes without first opening the connection explicitly. That is, I can just drop in a shared varaible Read VI, wire a constant to the refnum input, and it will work. I'm wondering, then, what benefits are offered by explicitly opening the conenction ahead of time...?
I guess I could see some cases where you want to open all necessary connections in an initialization state of a top-level state machine, particularly if you want to use the "Open & Verify Connection"---so you could jump straight to an error case if any connections fail. But other than that, why else might one want to explicitly open the connections.
And, along those lines, are there any problems with implicitly opening the connections? One reason why I am hesitant to open them explicitly is because for one of our applications, we need to be able to dynamically switch from one variable to another at runtime. It would be nice to just switch the variable refnum (wired to the input of the Read function), without having to manually close out the old connection and open a new one. A quick prototype of this seems to work. But am I shooting myself in the foot by doing so?
Thanks in advance.

I'd expect there's a very small number of people at NI that would know the answer to the detail you're asking for.  But, let's try to extrapolate from this rather old post to see if we can understand what they're forming their impression on.
The shared variable has to have some sort of reference going on in the background.  It looks like they're calling this a connection.  It's how LabVIEW knows where to find this variable on the network.  We can also see this reference certainly exists if we're opening/closing the reference in the explicit method.  You see the connection as just a string referencing the variable by URL.  This "reference" has to be stored somewhere.  No matter how we're looking at this, we're aware there's a reference of some sort stored. 
Now, we'd want to look at what would cause this reference to go away.  If you open/close explicitly, it's easy to see it goes away at the close.  If it's implicit, when would it make sense to close it out?  The VI can't be expected to guess where it's done being referenced and close it out.  This puts us into a situation where the soonest it could close is when the VI ends.  From my experience, references tend to be wiped when you close out LabVIEW.  It's this kind of idea that makes the FGV possible.  I wouldn't be surprised by Morgan's claim here.
If we look at scalability, you're talking about two different topics.  You're talking about adding an extra open, close, read, etc rather than just a few wires.  That certainly would look a mess.  In terms of the dynamic swap that was being discussed, we wouldn't be adding all of those.  The concern would be if enough connections were opened it'd start to behave similar to a memory leak.  This could be something that works with a smaller number of variables.  If you continue to scale, it becomes problematic.  This is why they suggest it's not scalable. 
To your questions:
Does LV allocate some kind of session in memory using that string as a lookup?
It would HAVE to allocate some memory to hold that string.  Otherwise, it'd be pointless to even have the reference. 
Does it reuse that session if other parts of the application reference the same variable, or does it create a unique session for each referencing call to "Read Variable.vi"?
I would expect this to be "it depends."  With the implicit method, I would expect it to open a new reference in each point it isn't wired.  This is similar to int x,y = 5;  x and y share the same value but are their own unique memory location.  If you wire the reference to the other points, it should use the same reference.  This would make more sense to me than the program seeking out any other potential usage of the variable in the application to see if there's already a reference open.  I could be wrong, though.
And what resources does this "connection" actually represent?
At best, this is just the string.  At worst, it's the string and the TCP socket.  I'd lean towards the first.  Opening and closing sockets should be relatively easy in most applications.  But, it also wouldn't surprise me if it holds the socket.
I'm sure others have a better understanding than I do.  But, that's what I'd expect for anything you've asked.

Similar Messages

  • Why does my curser open and close 2 windoows at once ????

    When I click on a item in a window or sometimes when I close a widow the pointer operates whatever is underneath as well, that may be to close a window or it could be a link on the page undernesth that then opens . This is driving me crazy. i did every Virus check there is, still no success.

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • With a full screen application open, if you then open and close LaunchPad, the dock will not go away!

    This is especially annoying if you have hot corners for LaunchPad and accidentally open it with a full screen app open, because the Dock will not leave!  Try it: open any app in full screen, open LaunchPad with a gesture or hot corner, exit out of LaunchPad and the Dock will be at the bottom of the full-screen app, obscuring the bottow 10% or so of the screen.  Any fixes, or something to come on Apple's end?

    below is what I get with the dev.jeffersonscher.com etc. url. But what do I do with this information? I can launch safe mode, but I still get only the 2" icon/window of Firefox.
    JavaScript Browser Tests
    navigator object properties
    navigator.userAgent = Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)
    navigator.appName = Microsoft Internet Explorer
    navigator.appCodeName = Mozilla
    navigator.appVersion = 5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)
    navigator.platform = Win32
    DOM methods/collections
    if(document.getElementById) = true
    if(document.layers) = false
    if(document.all) = true
    window properties
    if(top.window.moveTo) = true
    if(top.window.moveTo(0,0)) =
    The following data is reported by a server running Microsoft IIS server and ASP:
    View selected http headers at <a href="svrvars.asp">svrvars.asp</a>

  • Why can't I open and close tabs with scroll, after updating to Firefox 10???

    I updated my Firefox, and opening or closing tabs whit scroll button doesn't work any more.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    Your Firefox 9.0.1 is not the latest version anymore, so please update to the latest Firefox 10.0.x version via Help > About Firefox.

  • Open and Close Posting Period (OB52)

    Dear Experts,
    My client wants to close the posting period of the previous month. 
    First I went to transaction OB52 to define an entry From Per. 1 2008 To Per. 12 2009 to open all the posting period for the year.  But when the time passes, do I have to manually change the From Per. back to the current month (e.g From Per.1 2008 changed to From Per. 2 2008 and so on)
    If this is the case, is there any way to make this a automatic function to do this.
    Points will be rewarded.
    Thanks.

    Hi,
    You define posting periods in your fiscal year variants. You can open and close these posting periods for posting. As many periods as you require can be open for posting simultaneously. Special periods can be open for closing postings during the period-end closing.
    You have the following options for opening and closing posting periods:
    - Posting Period Variants: You can specify which company codes are open for posting in a posting period variant. Posting period variants are cross-company code and you have to assign them to your company codes.
    - Account Type: You can differentiate the opening and closing of posting periods by account type. This means that for a specific posting period, postings can be permitted to customer accounts, but not to vendor accounts.
    - Account Interval: You can differentiate the opening and closing of posting periods by account intervals. This means that you only open a posting period for posting to a specific account.
    Path for making the settings for opening and closing posting periods:
    Customizing for Financial Accounting under Financial Accounting Global Settings -> Document -> Posting Periods
    For detailed example for opening and closing posting periods please refer the link below:
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/96/8b300943ce11d189ee0000e81ddfac/frameset.htm
    I hope it will help.
    If helpful, please assign points.
    Regards,
    Manju

  • Why would Siri open and close randomly?

    My iPhone 5 displays the oddest and most erratic behavior and I cannot figure out why!  Hopefully someone here can head me in the right direction!
    A few times a week, Siri will pop up with her "What can I help you with" window.  I'll close it and it will reopen again.  Sometimes it even causes other apps to open.  Open and close.  Over and over.  It happens randomly or at least I cannot see the common denominator anyway.   I use a bumper with my phone but it does not cover or even touch the screen button.  
    Any ideas?
    Thanks for the help!
    Peter

    It is possible that you are pressing the home button while the phone is in your pocket. If this is not the case then plug your phone into your computer and use iTunes to restore your phone. Also restore as a new iPhone not from backup.

  • Would you Open and Close DAQmx tasks within a function or Globally

    Hi Guys,
    This should start something.
    The subject is DAQmx Tasks.
    If you were writing a function that is called many times, say MeasureVolts (double *Value) to obtain a reading from an Analogue Input Channel.
    Would you.
    1. open and start the task inside the function, do the measurement and then close the task inside the same function.
    or
    2. open the task globally and later do the measurement inside the function using the global task then close the task only when the application is closed.
    I am mostly concerned with the overhead of task generation and closing, what do you guys and girls out there do?? and what is the general opinion?
    I would appreciate your views.
    Regards
    Paul.

    I would definitely NOT keep configuring and clearing (I think that's what you mean by open and close) the same task over and over.  I would configure once, read many times in my main app, then stop & clear once.
    I typically like to package such data acq into an "Action Engine" that keeps track of its own DAQmx task id so I don't need to sling that task id wire around into multiple parallel loops / vi's.  Attached is a very stripped-down example for Digital Input. 
    I would typically do more with error testing and would make the "Action" enum into a typedef custom control, but this gives you the basic idea.  The action engine approach works very nicely when there's a small # of different kinds of input parameters and output info needed to support all the necessary action cases.   When you start needing a large number of differnent kinds of inputs and outputs to support the desired actions, then you start having difficulty with (1) having enough terminals to wire and (2) remembering which inputs and outputs are meaningful for which actions.
    -Kevin P.
    Attachments:
    DI Action Engine.vi ‏75 KB

  • My iPhone camera will not open up. When I press on the icon it open and closes quickly. When I open it from my home screen it reboots my phone. What should I do?

    My iPhone camera will not open up. When I press on the icon it open and closes quickly. When I open it from my home screen it reboots my phone. What should I do?

    Tried that and it still isn't working. Not sure if it's software thing but I just noticed when I swipe up my control center the flashlight option is not available as well. I'm not sure why this is. I have a 5s with the newest software. That's for the suggestion

  • Safari is slow to open and close. It also slows down other apps while running. Should I reload safari and if so, how do I do so?

    Safari is slow to open and close. It also slows down other apps while it is running. How can I resolve this issue?

    From the Safari menu bar, select
    Safari ▹ Preferences ▹ Extensions
    Turn all extensions OFF and test. If the problem is resolved, turn extensions back ON and then disable them one or a few at a time until you find the culprit.
    If you wish, you may be able to salvage the malfunctioning extension by uninstalling and reinstalling it. That will revert its settings to the defaults.
    If there's no improvement, continue as follows.
    From the Safari menu bar, select
    Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data
    and confirm. Test.

  • Find open and close smart quotes

    Dear scripter,
    Here I am trying find whether all the open double smart quotes(") are closed with close double smart quotes("). Here is my small work to find how many open and close quotes.
    myopenqu=app.activeDocument.search("^{", false, false, "^{");
    myclosequ=app.activeDocument.search("^}", false, false, "^}");
    myopenqulength = myopenqu.length;
    myclosequlength = myclosequ.length;
    if(myopenqulength!=myclosequlength)
    alert("Quotes not matched\n"+ myopenqulength +" Open quotes found\n" + myclosequlength +" Close quotes found")
    It works well, the script just alert if I have 25 open quotes and 23 close quotes
    Quotes not matched
    25 Open quotes found
    23 close quotes found
    Now I want to find the quote set where the 24,25th set close quotes are missing?
    Is there any way to find the misisng quotes
    Thanks in advance
    regards
    a r u l
    vpublish.net

    You'd have to look for unmatched quotes, in this case two cases of two open quotes without an intervening closed quote. This is difficult to script in CS2 because it doesn't have GREP natively and because of footnote problems. In CS3/4 it should be possible. But even then it will work only if you don't have quotes within quotes.
    Peter

  • Since installing LTR 5.4, which I've now upgraded to 5.6, I've encountered repeated slowness and malfunctions in operations, especially when using the Compare View function and the Tab key to open and close the right and left side panels.  Such problems n

    Since installing LTR 5.4, which I've now upgraded to 5.6, I've encountered repeated slowness and malfunctions in operations, especially when using the Compare View function and the Tab key to open and close the right and left side panels.  Such problems never arose during two years of using LTR-4 and nothing else has changed on my computer.  I have a pretty simple system with only a few plug-ins, which are usually not in operation.  I have 12GB of RAM in my Windows 7 PC.  I could illustrate these problems with screen shots if you would tell me how to submit screen shots.  Otherwise I will try to describe the problems in words.
    The problem is clearly cumulative, growing worse as usage time passes.  Compare View feature gradually slows down and eventually seems to choke as my work session proceeds. If I Exit LTR and re-enter and start all over, things will work normally for maybe 30 minutes, but then the Compare View feature begins to become very slow to respond.   In a recent example with my screen full of thumbnails in Library mode I highlighted two images to compare. LTR started to open the Compare View screen by first having the top row of thumbnails disappear to be replaced by the "SELECT" and "CANDIDATE" words in their spaces  (but no images), but Compare View never succeeded in gaining control of the screen. After some seconds the top row of thumbnails reasserted its position and the Compare View windows disappeared. But LTR kept trying to bring them back. Again the top row of thumbnails would go away, Select and candidate would reappear, try again, and give up. This went on for at least 2-3 minutes before I tried to choose File and Exit, but even that did not initially want to respond. It doesn't like to accept other commands when it's trying to open Compare View. Finally it allowed me to exit.
    To experiment I created a new catalog of 1100 images.  After 30-40 minutes, the Compare View function began to operate very slowly. With left and right side panels visible and two thumbnails highlighted, hitting Compare View can take half a minute before the two mid-size  images open in their respective SELECT and CANDIDATE windows. When the side panels are open and two images are in the Select/Candidate spaces, hitting the Tab button to close the side panels produces a very delayed response--25-30 seconds to close them, a few more seconds to enlarge the two images to full size. To reverse the process (i.e., to recall the two side panels), hitting Tab would make the two sides of the screen go black for up to a minute, with no words visible. Eventually the info fields in the panels would open up.
    I also created a new user account and imported a folder of 160 images. After half an hour Compare View began mis-placing data.  (I have a screen shot to show this.)  CANDIDATE appears on the left side of SELECT, whereas it should be on the right. The accompanying camera exposure data appears almost entirely to the left of the mid-screen dividing line. Although the Candidate and Select headings were transposed, the image exposure data was not, but the data for the image on the right was almost entirely to the left of the line dividing the screen in two.
    Gurus in The Lightroom Forum have examined Task Manager data showing Processes running and Performance indicators and they see nothing wrong.  I could also send screen shots of this data.
    At this point, the only way I can process my images is to work 30-40 minutes and then shut down everything, exit, and re-start LTR.  This is not normal.  I hope you can find the cause, and then the solution.  If you would like to see my screen shots, tell me how to submit them.
    Ollie
    [email protected]

    Since installing LTR 5.4, which I've now upgraded to 5.6, I've encountered repeated slowness and malfunctions in operations, especially when using the Compare View function and the Tab key to open and close the right and left side panels.  Such problems never arose during two years of using LTR-4 and nothing else has changed on my computer.  I have a pretty simple system with only a few plug-ins, which are usually not in operation.  I have 12GB of RAM in my Windows 7 PC.  I could illustrate these problems with screen shots if you would tell me how to submit screen shots.  Otherwise I will try to describe the problems in words.
    The problem is clearly cumulative, growing worse as usage time passes.  Compare View feature gradually slows down and eventually seems to choke as my work session proceeds. If I Exit LTR and re-enter and start all over, things will work normally for maybe 30 minutes, but then the Compare View feature begins to become very slow to respond.   In a recent example with my screen full of thumbnails in Library mode I highlighted two images to compare. LTR started to open the Compare View screen by first having the top row of thumbnails disappear to be replaced by the "SELECT" and "CANDIDATE" words in their spaces  (but no images), but Compare View never succeeded in gaining control of the screen. After some seconds the top row of thumbnails reasserted its position and the Compare View windows disappeared. But LTR kept trying to bring them back. Again the top row of thumbnails would go away, Select and candidate would reappear, try again, and give up. This went on for at least 2-3 minutes before I tried to choose File and Exit, but even that did not initially want to respond. It doesn't like to accept other commands when it's trying to open Compare View. Finally it allowed me to exit.
    To experiment I created a new catalog of 1100 images.  After 30-40 minutes, the Compare View function began to operate very slowly. With left and right side panels visible and two thumbnails highlighted, hitting Compare View can take half a minute before the two mid-size  images open in their respective SELECT and CANDIDATE windows. When the side panels are open and two images are in the Select/Candidate spaces, hitting the Tab button to close the side panels produces a very delayed response--25-30 seconds to close them, a few more seconds to enlarge the two images to full size. To reverse the process (i.e., to recall the two side panels), hitting Tab would make the two sides of the screen go black for up to a minute, with no words visible. Eventually the info fields in the panels would open up.
    I also created a new user account and imported a folder of 160 images. After half an hour Compare View began mis-placing data.  (I have a screen shot to show this.)  CANDIDATE appears on the left side of SELECT, whereas it should be on the right. The accompanying camera exposure data appears almost entirely to the left of the mid-screen dividing line. Although the Candidate and Select headings were transposed, the image exposure data was not, but the data for the image on the right was almost entirely to the left of the line dividing the screen in two.
    Gurus in The Lightroom Forum have examined Task Manager data showing Processes running and Performance indicators and they see nothing wrong.  I could also send screen shots of this data.
    At this point, the only way I can process my images is to work 30-40 minutes and then shut down everything, exit, and re-start LTR.  This is not normal.  I hope you can find the cause, and then the solution.  If you would like to see my screen shots, tell me how to submit them.
    Ollie
    [email protected]

  • Open and Close Front Panel of SubVI

    Hi all,
    Running LabVIEW 2011 on Windows 7 x64.  I am trying to get a subVI front panel to open from my main FP with the press of a button and then close with a button press in the subVI.  Here is the piece from my main FP that calls the VI and opens the FP 
    Plots is defined in another loop and all of the loops are in a flat sequence.  I did it this way because I want it to start with the first press and not stop my main loop from running.  I have moved the item in the left loop around a lot so I'm not sure if I can run that in the same loop as the event or not.  Either way opening the VI seems to work fine.
    The problem shows up when trying to close the subVI for the SECOND time.  The code is here:
    As I said, the first time I open and close the VI everything works as I expect it should.  I am then able to open it again but now the "blank button" doesn't function and I can't close the window or even open the block diagram to probe anything.  I have been trying to figure this out for awhile, any insite would be greatly appreciated!
    Thanks
    Solved!
    Go to Solution.

    Its good that you found the bug.
    This code may serve as a way for you to compare notes.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Open and Close Shelf Effect

    Relative newb to Flash and not sure what the issue is but I have a shelf opening and closing effect  The timeline is 45 frames long and when the shelf is out it has this AS3 code in it:
    import flash.events.MouseEvent;
    stop();
    ShelfOpen,addEventListener(MouseEvent.CLICK, closeShelf);
    function closeShelf(evt:MouseEvent){
    gotoAndPlay(17);
    Once clicked, the shelf closes and only a sliver of the shelf appears.   The person can re-open it by clicking the sliver at frame 30 using this code:
    import flash.events.MouseEvent;
    stop();
    ShelfOpen,addEventListener(MouseEvent.CLICK, openShelf);
    function openShelf(evt:MouseEvent){
    gotoAndPlay(31);
    In the last frame (45) I have the code:
    gotoAndStop(16)
    which should return the shelf to its open position and allow the user to close it again if they click in the shelf, but it seems to be listening at at frame 30 and just running the Open Shelf motion again.  I would just like the user to be able to open and close the shelf as they like.  Any help would be apprecaited.
    -DC

    See if removing the event lsteners in the event handlers helps, as in...
    ShelfOpen.addEventListener(MouseEvent.CLICK, closeShelf);
    function closeShelf(evt:MouseEvent){
       ShelfOpen.removeEventListener(MouseEvent.CLICK, closeShelf);
       gotoAndPlay(17);
    (similarly for the other)
    and make sure you are not using commas after ShelfOPen like you did in the code you posted.

  • Open and close posting periods urgent! (ob52)

    Hi SAP gurus,
    i am trying to post open and close balances (it is spesific to my country) however i do not want users to post to 2007 except me.
    how can i achieve this with not blocking all users.
    in other words, i need authorization to post last year although it is closed for all users.
    note: can you pls explain the difference btw "from period 1" and "from period 2"  in OB52. and also there is an authorization group at the last column what does this mean?
    thx in advance.

    Hi,
    If you stand on the field "authorization group" and use "F1" you can find the help on that field, you will find that it is very helpful.
    You should define period 2 for all users and period 1 to the restricted users,
    Next, you should assigned a free symbol in the field "authorization group" (which refer to period 1), then ask the person that responsible in your organization of the authorization to assign the authorization object F_BKPF_BUP with that specific symbol to the restricted users,
    That should do the job.
    If that helps, feel free to assign points…
    Kind regards,
    Yoav

  • Open and Close OnScreen Keyboard while focus gain on JTextField

    Hi
    I have a Jtextfield when ever I click on textfield I want to open OSK(On Screen Keyboard) of Windows 8 OS and windows 7.
    I tried in below mentioned way to open and close in focus listener focusGained() and focusLost() but it is not working. could some body do needful.
    Opening OSK:
    builder = new ProcessBuilder("cmd /c " + sysroot + " /System32/osk.exe");
    Closing Osk:
    Runtime.getRuntime().exec("taskkill /f /im osk.exe");

    You need to start() the ProcessBuilder and you need to split the command like this:
    builder  = new ProcessBuilder("cmd", "/c", sysroot + " /System32/osk.exe");
    builder.start();
    And naturally you should wrap the call in a new Thread or use an ExecutorService to avoid EDT problems.

Maybe you are looking for