Re: The code example in onSpinWait() Javadoc

Andrew Haley via Concurrency-interest <[email protected]>
Newsgroups gmane.comp.java.jsr.166-concurrency
Message-ID <[email protected]>
On 11/15/19 1:31 PM, Alex Otenko via Concurrency-interest wrote:
> I am not arguing. I want to see justification for wanting something that
> looks like a solution to an intractable problem.
> 
> I see onSpinWait as an indicator to the JVM that it can do something
> useful, like possibly help FJP make some progress. I can't see how a time
> bound can be enforced there.

But that is not what "onSpinWait" means, that is what "yield" means.
The idea of "onSpinWait" is to reduce latency in spin loops, where
latency is measured in tens of nanoseconds. "onSpinWait" is not
supposed to free the processor to do something else.

I don't think there's anything much wrong with the example in the Javadoc,
and the Javadoc is not supposed to be a tutorial.

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671

_______________________________________________
Concurrency-interest mailing list
[email protected]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.