07-01-2005 12:25 PM
07-01-2005 12:53 PM
07-01-2005 12:59 PM
07-01-2005 01:24 PM
07-01-2005 01:26 PM
I agree with dennis, use the exit application as a very last resort. Especially with a driver you want to make sure you leave a device in a safe (from the user and instrument) state. The last thing you need to do with a driver is leave an instrument in a dangerous state or fry your (usually many $1000s) equiptment. Error handling will allow this; each vi can have a case structure and error in and outs to allow for error propagation. This will prevent the vi from executing in an error state, and the error can be passed to calling loops for stopping infinite loops. Also for drivers you can implement timeout and watchdog situations to further prevent calling programs from crashing on driver calls. I am not really sure why the exit application is provided, just encourages bad programming practices.
Paul
07-01-2005 01:49 PM
07-01-2005 05:24 PM - edited 07-01-2005 05:24 PM
Well all I feel a little 'ganged up on' there and if one took Pauls comments to heart, some less sensitive souls might have burning ears.
In the spirit of discussion rather than direct critique; I post the following from the 'on-line documentation' to clarify my perhaps overly concise previous posting. Where the comment 'check out' might not be taken in the spirit within which it was intended.
"If quit? is TRUE (default), LabVIEW quits. If you wire an error cluster to quit? and an error occurs, the error cluster passes a TRUE value to the function. "
Paul, are you proposing that the Exit function is not the correct exit technique from Labview?
Message Edited by Conseils on 07-02-2005 12:25 AM
07-02-2005 08:30 AM
07-02-2005 08:56 AM
07-02-2005 02:35 PM
This is exactly the discussion I was hoping to stimulate. (I
hope interesting, educational and possibly controversial). I think that the
most valuable part of the discussion to date is your experience and issues with
the application of the Exit vi.
I suspect I may be about to commit heresy to many. But in suggesting what
follows, I hope you will keep in mind a British comedy that I like called
'Black Adder' with Rowen Atkinson. I am applying this to many levels in this
response. I admit to brevity again here....
He is struck with a dilemma of forbidden love and cares what the world will
think and goes to the 'Wise Woman' for advise on his problem: -
She gives him three possible solutions: -
Kill yourself - 'No' says he.
Kill the object of desire - 'Not really' says he.
Kill everyone else - 'Not really practicable' says he.
He elects not to take the advice of the 'Wise Woman' - It transpires that there
was a solution, as there was an error - he just didn't have all the
facts..........
To add one small part to the story, I would like to add that everything dies
eventually!
So here it comes.... Everyone SHOULD be putting in at least one EXIT vi in a
production application!
Still sat in your seat?
I propose - For exactly the reason that has been pointed out with regard to the
hardware and safe shut down. That is to allow the software (LabVIEW) to do the same. To
explicitly and formally state when and where the application terminates - Even
if in principle it is not actually intended that it should - the exit point and
software shut down sequence should be clearly indicated. I would suggest there
should be normally one exit point for a classical application.
To this end the example posted would be modified to include the EXIT vi - when
the designer has, resolved all issues or just can't cope any more.
What one tends to see, both in this forum and in released applications; is
development code or applications that were never reviewed to completion. Effectivley Beta applications.
NI don't put the EXIT vi's in Examples; as it, of course, EXIT's LabVIEW
cleanly and completely!!!! (bit of a pain for a novice). But as a result neither do many others.
So are you a convert to the cause?
Now my questions to the forum are: -
Do you allow for and provide, a single point of software shutdown;
clearly stated and explicitly defined for production applications (would you
admit you don't / haven't)?
If you don't; what do you do?
How do you go about trying to assure clean up of any problems (I have
yet to meet the perfect systems designer, I live in hope).