This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How can I ensure a semaphore is not set

Hi,

I want to wait for an event by pending on a semaphore.  I want to make sure the semaphore is not set before I start waiting to ensure the event occurs.

What is the best way to ensure a semaphore is cleared before pending on it

psuedo code:

 - clear semaphore

 - start event

 - pend on semaphore (which is set when event completes)