hooovahh Posted December 18, 2007 Report Share Posted December 18, 2007 Hello all, I found some thing that isn't really a bug in LabVIEW but it can be annoying. I'm working with a set of code that will scan a directory of LabVIEW VIs and create documentation for each VI. To prevent race conditions and other resource issues a semaphore was created. Since the number of VIs in the directory can be quite large, the time between steps may also take a long time. So the timeout terminal on the Semaphore was wired to be a -1 since there is no way to know how long it should wait before giving up. With this set up I found that when an error occurred the program would hang forever and it took me a little while to discover why. Apparently if an error is wired into the error in terminal of any semaphore VI it will still attempt to execute the code. I can see where this could be a good thing, like for a Release Semaphore. If an error occurred we should still try to Release the Semaphore. But with an Acquire Semaphore I would think the code would just pass the error out if there was an error in. Here's the help on the Acquire Semaphore VI http://zone.ni.com/reference/en-XX/help/37...uire_semaphore/ Twords the bottom is where you'll see it mentions how it will behave with an error in. To fix my code I simply have to check to see if an error in happens before the Acquire Semaphore VI, if it does just pass the error out. In my defense I didn't write this code but if I did I probably would have done the same thing and just assumed that the Semaphore VIs behaved as a lot of code does. Quote Link to comment
Aristos Queue Posted December 18, 2007 Report Share Posted December 18, 2007 QUOTE(hooovahh @ Dec 17 2007, 03:09 PM) To fix my code I simply have to check to see if an error in happens before the Acquire Semaphore VI, if it does just pass the error out. In my defense I didn't write this code but if I did I probably would have done the same thing and just assumed that the Semaphore VIs behaved as a lot of code does. The expected solution is that you would just have Release Semaphore also be outside of your error case structure so that any time Acquire Semaphore executes, Release Semaphore is also guaranteed to execute. 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.