View Single Post
  #9   Spotlight this post!  
Unread 31-03-2013, 19:20
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Robot/Dashboard communication and the FMS

I was asking for several reasons. From the manual ... "If you use this VI to obtain multiple references to the same named semaphore, each reference number is unique. "

So it is saying that each obtain should be balanced with a close. If it isn't, you wind up with quite a few refnums in short order.

I also ask, because the semaphore is often not the right tool for the job. They are a rather dangerous way to protect compared to the critical section that is built into every subVI. So the recommended way to protect a global is simply to wrap it in a function that is not reentrant. This critical section is considerably safer as it cannot be mismatched. The semaphore is only needed when the acquire and release are far removed from each other.

Greg McKaskle
Reply With Quote