[concurrency-interest] JDK 9 FutureTask's use of Thread.yield

Dávid Karnok akarnokd at gmail.com
Thu Feb 2 08:01:51 EST 2017


I'm trying to port some some building blocks of Java's ExecutorServices to
less fortunate platforms and I've noticed FutureTask of JDK 9 uses
Thread.yield in some of its spin loops (
http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/e170c858888e/src/java.base/share/classes/java/util/concurrent/FutureTask.java#l333
for example) to wait some other party to finish up.

Maybe this was discussed before, but wouldn't it make more sense to have
Thread.onSpinWait() at these locations (now that it is available) just by
itself or as a code that leads to the current Thread.yield() approach?

-- 
Best regards,
David Karnok
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20170202/609fa6d6/attachment.html>


More information about the Concurrency-interest mailing list