Spin Loop Hint support: Draft JEP proposal

David M. Lloyd david.lloyd at redhat.com
Thu Oct 8 11:01:51 UTC 2015


On 10/08/2015 05:58 AM, Doug Lea wrote:
> On 10/06/2015 09:28 PM, Gil Tene wrote:
>>
>> As for fitting in with larger-picture or theme things (listed above).
>> I think that
>> agonizing over the choice of where to put this is important
>
> To avoid the kinds of problems we later saw when basic JVM methods were
> placed in odd places just for the sake of appearances (e.g., park/unpark),
> the best choice seems to be class Thread, as in:
>
> class Thread { //
>    /**
>     * A hint to the platform that the current thread is momentarily
>     * unable to progress. ... add more guidance ...
>     */
>    void spinYield();
> }
>
> In principle, this would also allow the implementation to do an actual
> yield on uniprocessors or when the load average is high. Probably not
> in initial implementation though.
>
> Adding a method to class Thread risks name clashes with existing
> methods introduced in subclasses. So this might need a clunkier name
> to effectively eliminate the possibility.

If the method is static, then the impact of a clashing name should be 
fairly minimal.

-- 
- DML



More information about the core-libs-dev mailing list