Hi David, On 11/08/2016 12:48 PM, David Holmes wrote:
Sorry didn't see Staffan's earlier reply :)
Thanks anyways!
You should always perform a wait() in a loop checking the condition that is being waited upon. This guards against lost-notifications and also spurious wakeups.
If you both are talking about signals + pthread_cond_wait, we can fix that with e.g. semaphore instead. (since it keeps track of the number of posts) But that's whole nother discussion... :)
Lost notification, I don't see that?
If the notifyAll() happened before you get here then you will wait() until jtreg does time you out - even though the notification correctly occurred.
Correct, might work with move the start of synch block just after listener creation, before addListener, but maybe deadlock prone with mbsc.invoke ...
/Robbin