07-06-2005 03:52 PM
07-06-2005 08:38 PM
Actually, I would sat that the use of shift-registers in ths situation is problems waiting to happen. However this code has a lot of other problems.
To begin with the code takes a single queue reference and sends it two places. This is asking for trouble. What happens if the lower loop finishes and releases the reference while the top loop is still using it?
Next there's a place in the code where an error cluster passes through a FOR loop using tunnels. This is very bad because a FOR loops can execute zero times. In this situation, the result is that you will never see any errors that happened before the loop. Consider what happens if tlc_Cue_Module.vi generates an error. The output (which is specifying the loop count) will most likely be zero. No iterations, no data passed through--your code isn't working and you don't know why. Or worse, you might not even know there was an error and you think its working but it really isn't.
Finally, if an error occurs during initialization (before the split in the queue reference) the lower loop will never quit because there is no way to tell it to quit because you can't generate the event. But even if you could, an error keeps the lower loop from even looking for events. The proper way to manage errors in a event-driven process is to always provide an event that gets triggered if an error occurs. That way the code will always have some place to go.
I realize that this was probibly an exercise from the class, but whatever you do don't write real applications this way.
Mike...
07-06-2005 08:51 PM
07-07-2005 02:51 AM - edited 07-07-2005 02:51 AM
Message Edited by rolfk on 07-07-2005 02:52 AM