Go to Post Life is too short to spend 40 hours a week doing something you are not enthusiastic about. - Karthik [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 12-02-2016, 08:39
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Button Press subVI

The sample code contains a simple button press subVI that was thrown in just to show how these sorts of things are done. If you start to use it in more than one place in your code, you will find that it doesn't work very well. This happened at our shop last night.

The VI is not reentrant. This means that only one caller may execute the code at a time, and it means that state data, such as the feedback node that remembers the last call data, is shared across all calls. Basically, the side-effects of the call, where the previous data is stored, is modified by subsequent calls, and the next call will not work as expected.

The solution is to go to the VI Properties, Execution page, and set the VI to be preallocated reentrant.

Preallocated reentrant VIs allow for simultaneous calls and allocate state data for each caller at load time.

In case you are wondering what Shared reentrant VIs do, they allow for simultaneous calls, but operate a pool of state data storage that is as big as the number of simultaneous callers. This is great to save memory when you the state data is actually a temporary buffer and not call-site specific to the operation of the function.

In hindsight, it probably should have been made reentrant to protect the state data, but I never made a copy, so didn't think about it.

Greg McKaskle
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:07.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi