alphaone Posted February 20, 2006 Report Share Posted February 20, 2006 Hi, the following VI domestrates the LV2G of a semaphore named "test", but the semaphore can't GET . Is reasonable to use LV2G for semaphore? or something happened here? So strange. Download File:post-2988-1140439962.vi Quote Link to comment
Grampa_of_Oliva_n_Eden Posted February 20, 2006 Report Share Posted February 20, 2006 Hi, the following VI domestrates the LV2G of a semaphore named "test", but the semaphore can't GET .Is reasonable to use LV2G for semaphore? or something happened here? So strange. Hi Alphaone, I just tried out your posted VI and it works fine as long as the VI does not go idle. I dropped into a VI and did a "New" followed by a "get". The returned ref was good to acquire a semaphore and release it. I suspect you are letting your VI go idle or you are not executing in the correct order. I used a sequnece structure to force your VI to work. Error in/out cluster would be a better approach. I hope that hlep, Ben Quote Link to comment
jpdrolet Posted February 20, 2006 Report Share Posted February 20, 2006 Hi, the following VI domestrates the LV2G of a semaphore named "test", but the semaphore can't GET .Is reasonable to use LV2G for semaphore? or something happened here? So strange. The error comes because you must create the semaphore before using it. Call with NEW on the first call. When wrapping refnums in a functional global, I usually test for a valid refnum before returning it. It automatically takes care of initialyzing on first call. You can then get rid of the NEW case. Quote Link to comment
alphaone Posted February 21, 2006 Author Report Share Posted February 21, 2006 The error comes because you must create the semaphore before using it. Call with NEW on the first call. When wrapping refnums in a functional global, I usually test for a valid refnum before returning it. It automatically takes care of initialyzing on first call. You can then get rid of the NEW case. So, the semaphore is stored in global and refered by its name, right? i only hold its name and "new" the semaphore when i need it. Quote Link to comment
TG Posted June 18, 2006 Report Share Posted June 18, 2006 This topic is intriguing to me. What could this LV2 semaphore be used for Whats the hook? Is it the global access to a consisiently valid semaphore? Quote Link to comment
Jim Kring Posted June 18, 2006 Report Share Posted June 18, 2006 This topic is intriguing to me.What could this LV2 semaphore be used for Whats the hook? Is it the global access to a consisiently valid semaphore? Yes, it is to create a global, named semaphore. The reason that the test for a valid semaphore reference is useful, is because the reference will go invalid when the top-level VI in the call chain that created it goes idle (stops running). This makes testing components (by pressing thier run buttons) possible, rather than requiring that the entire application be running. 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.