Jump to content

The LV2G for semaphore


Recommended Posts

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

Link to comment
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.

post-447-1140442331.png?width=400

Link to comment
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.

post-447-1140442331.png?width=400

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.

Link to comment
  • 3 months later...
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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.