#12 FiniteQueue: dequeuers don't call notify()


I'm looking at the FiniteQueue code and see that
although enqueueMany calls a notifyAll() on the "blocker"
monitor, the single enqueue (enqueue 1 item) calls
notify(). That's great, and actually, enqueueMany could
use the
notify() instead of notifyAll() if the number of
element is lower than the maxBatch size.

But my concern is about the dequeuers: they don't call
notify(). So if a stage enqueue one item at
a time, only one thread wakes up (notify()) and when
this thread completes the dequeueing (still
hasn't processed anything), other threads are not
jumping behind to dequeue.

Seams obvious that if a thread does not dequeue all
items, there are some item left available to other
threads and they should know about it, hence the
missing call to blocker.notify() inside dequeue.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks