<p>I've recently seen the light of EventWaitHandle's powerful behavior in C# and decided to move some functionality in a sister application to do the same. The only problem is that the sister app is written in C.</p>

<p>No big deal, I'm using pthreads, which have a pthread_cond_t datatype that allows for signalling. My only question is, is it possible for a cond to be 'signalled' before something is waiting on it?</p>

<p>Right now my testing says no. That is, if ThreadA fires a signal before ThreadB is waiting, ThreadB will wait indefinately. Is there another pthread type that I can use that behaves closer to the functionality of the EventWaitHandle in C#? An object is signalled, meaning that the first thread to wait on it, will pass immediately, and set it to unsignalled.</p>

<p>Wrapping the pthread_cond into another data structure wouldn't be too hard to achieve this. But again, is this functionality already available in the pthread library?</p>

If you're using condition variables correctly, this won't matter.
The basic flow of your code should be (in pseudocode):
```
```
lock(lockobj);
while (!signalled) {
    wait(condvar);
}
signalled = false;
unlock(lockobj);
```
```
on the waiting side, and:
```
```
lock(lockobj);
signalled = true;
notify(condvar);
unlock(lockobj);
```
```
on the signalling side. (Of course, the lock object and condition variable used have to be the same on both sides.) Hope this helps!