We encountered a dual-core issue in a software not using JUCE.
One of my fellow colleagues warned me about a common coding error using the pthread API, and I looked for that in our entire source code tree.
And I found out what he warned me against in the Juce source code.
The problem is in the WaitableEvent class implementation, in juce_Posix_SharedCode.cpp.
According to the pthread_cond_wait documentation here http://docs.hp.com/en/B9106-90010/pthread_cond_wait.3T.html, pthread_cond_wait should be used inside a loop, like this :
[code]
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
(void)pthread_mutex_lock(&mutex);
while (predicate == FALSE) {
(void)pthread_cond_wait(&cond, &mutex);
}
(void)pthread_mutex_unlock(&mutex); [/code]
This is to
[quote]
pthread_cond_wait() is recommended to be used in a loop testing the predicate associated with it. This will take care of any spurious wakeups that may occur.[/quote]
I am not an expert in this area, but for my colleague, who is, this is the way things should be done.

