Hi Bill,

> I'm also worried about this same scenario with the new locking stuff in
the
> mainline.  With notifyAll instead of just notify is there a chance to
starve
> threads?  With notify aren't you guarateed FIFO for lock contention, but
you
> wouldn't be guaranteed with a notifyAll?

notify does NOT guarantee FIFO awakening of threads: the docs
explicitely state:

| The choice is arbitrary and occurs at the discretion of the
| implementation.

i.e. a LIFO or whatever implementation might lead to starvation.

notifyAll seems to be MUCH better as of the docs:

| The awakened threads will compete in the usual manner with
| any other threads that might be actively competing to
| synchronize on this object; for example, the awakened threads
| enjoy no reliable privilege or disadvantage in being the next
| thread to lock this object.

So every thread, if it was waiting before or just coming in
fresh, has the same chance to get the lock and proceed, avoiding
starvation.

Bye
Georg
 ___   ___
| + | |__    Georg Rehfeld      Woltmanstr. 12     20097 Hamburg
|_|_\ |___   [EMAIL PROTECTED]           +49 (40) 23 53 27 10



_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to