[concurrency-interest] Canceling Futures - Callable implementations

Joe Bowbeer joe.bowbeer at gmail.com
Thu Apr 9 14:20:33 EDT 2009


I was wondering if Thread.yield would raise a flag.  (If this were a real
code sample, it should raise a flag.)

I added Thread.yield, half as a joke, to indicate that my example was
spinning.

Thread.yield is a suggestion to the JVM that maybe there is better use of
the CPU elsewhere.  In this instance, I hope the JVM takes the hint, but I
don't care.  (Well, I would care if I ran my code on a non-preemptive
single-CPU system.)

I don't know which platforms ignore Thread.yield and which don't.

Joe

2009/4/9 Péter Kovács

> Just one more question:
>
> I noticed the Thread.yield() calls in your samples. I thought this
> call had any real effect only back when green threads were used. Can
> it still make any difference?
>
> Thanks
> Peter
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20090409/a01f9343/attachment.html>


More information about the Concurrency-interest mailing list