crelf Posted November 18, 2008 Report Share Posted November 18, 2008 QUOTE (BrokenArrow @ Nov 17 2008, 02:03 PM) Thanks Jim! Illumination. Just like the traffic lights Quote Link to comment
BrokenArrow Posted November 18, 2008 Author Report Share Posted November 18, 2008 QUOTE (Jim Kring @ Nov 17 2008, 03:36 PM) You're welcome.Now, just imagine all the other good stuff in http://labviewforeveryone.com' rel='nofollow' target="_blank">LabVIEW for Everyone Why can't I just give YOU $53 directly, and then you answer every question I have from now on? Quote Link to comment
ragglefrock Posted November 18, 2008 Report Share Posted November 18, 2008 QUOTE (BrokenArrow @ Nov 17 2008, 02:14 PM) Why can't I just give YOU $53 directly, and then you answer every question I have from now on? I'll do it for $52 Quote Link to comment
Jim Kring Posted November 19, 2008 Report Share Posted November 19, 2008 QUOTE (BrokenArrow @ Nov 17 2008, 12:14 PM) Why can't I just give YOU $53 directly, and then you answer every question I have from now on? When did this turn into a negotiation? QUOTE (ragglefrock @ Nov 17 2008, 02:43 PM) I'll do it for $52 When did this turn into a bidding war? Quote Link to comment
John Lokanis Posted November 19, 2008 Report Share Posted November 19, 2008 QUOTE (Jim Kring @ Nov 17 2008, 10:52 AM) No Race Condition (Good Code) http://lavag.org/old_files/monthly_11_2008/post-17-1226947783.png' target="_blank"> I think your 'no race condition' code still has a race condition. What is there to prevent the semaphone from being destroyed before the lower path is executed? I think you need to wire the semaphore or the error out of the release call in the lower loop to the border of the sequence with the destroy in it to 'ensure' that the destroy cannot happen untill all code paths needing the semaphone are complete. Also, the use of sequence frames and semaphores could be eliminated by instead protecting the data in a single element queue instead. This is a cleaner way to solve the problem and better coding practice, but would not demonstrate the use of the semaphone. Quote Link to comment
Jim Kring Posted November 19, 2008 Report Share Posted November 19, 2008 QUOTE (jlokanis @ Nov 18 2008, 11:45 AM) I think your 'no race condition' code still has a race condition. What is there to prevent the semaphone from being destroyed before the lower path is executed? I think you need to wire the semaphore or the error out of the release call in the lower loop to the border of the sequence with the destroy in it to 'ensure' that the destroy cannot happen untill all code paths needing the semaphone are complete. Great point -- yes, there is a race condition that could cause the destroy to happen before the bottom modification occurs. I originally (when I created the example) had something like the one, below, but I removed the error handling to emphasize the use of semaphores. You're right that (short of using error chaining) wiring the bottom semaphore reference to the destructor's sequence structure (as shown below) is a good fix. QUOTE (jlokanis @ Nov 18 2008, 11:45 AM) Also, the use of sequence frames and semaphores could be eliminated by instead protecting the data in a single element queue instead. This is a cleaner way to solve the problem and better coding practice, but would not demonstrate the use of the semaphone. Yes, you could definitely use a single element queue. You could also use a functional global variable. Along those lines, Appendix D of LabVIEW for Everyone (where I pulled this example from) provides a historical overview of the different mechanisms for doing by (non-native) object-oriented programming in LabVIEW (and shows the natural progression of technologies and features). However, it does not touch the single-element queue or other more advanced implementations of by reference objects. Thanks, -Jim Quote Link to comment
BrokenArrow Posted November 20, 2008 Author Report Share Posted November 20, 2008 QUOTE (Jim Kring @ Nov 18 2008, 02:21 AM) When did this turn into a negotiation? Don't take my stab at humor the wrong way. I was trying to point out how absurd NOT owning that book is, for the price Amazon is charging ($53 with free shipping). I actually have your older version. It'll be on eBay when my Ed.3 arrives, complete with coffee and beer stains! :beer: Quote Link to comment
Jim Kring Posted November 20, 2008 Report Share Posted November 20, 2008 QUOTE (BrokenArrow @ Nov 19 2008, 06:10 AM) Don't take my stab at humor the wrong way. I was trying to point out how absurd NOT owning that book is, for the price Amazon is charging ($53 with free shipping). I actually have your older version. It'll be on eBay when my Ed.3 arrives, complete with coffee and beer stains! :beer: No worries I hope you enjoy the 3rd edition. Feel free to bring it to NIWeek and I'll happily sign it -- but that might make it worth less on eBay than the coffee and beer stains Cheers, -Jim Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.