
Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
> Cases where it makes sense to poll are conceivable. If a thread holds a
> lock and another hardware thread running on the same chip is attempting
> to acquire it, then the second lock may poll in the expectation that the
this isn't locking, this is object waiting. in order for it to make sense
to poll, you would have to know that the other thread is about to signal -
and you can't know that. You're thinking of other types of locking
situations. (for example, a synchronized block may not yield right away in
certain circumstances)

Signature
Of making better designs there is no end,
and much refactoring wearies the body.
Thomas Hawtin - 11 Dec 2005 20:51 GMT
>>Cases where it makes sense to poll are conceivable. If a thread holds a
>>lock and another hardware thread running on the same chip is attempting
>>to acquire it, then the second lock may poll in the expectation that the
>
> this isn't locking, this is object waiting.
By "this is" you mean "this thread is about"? My next sentence, deleted
from the quote, follows onto the subject.
> in order for it to make sense
> to poll, you would have to know that the other thread is about to signal -
> and you can't know that. You're thinking of other types of locking
> situations. (for example, a synchronized block may not yield right away in
> certain circumstances)
If a lock is being used to wait, it's a reasonable guess that some other
thread(s) are using it to notify. Other threads using it to wait are
probably going to drop into the wait and release the lock pretty much
immediately. I guess you could use a lock for wait/notify and also for
other bits of exclusion, but I that probably falls under the category of
bad coding.
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/