Re: The code example in onSpinWait() Javadoc

Roman Leventov via Concurrency-interest <[email protected]>
Newsgroups gmane.comp.java.jsr.166-concurrency
Message-ID <CAAMLo=YdfH=oVmKM1YbME-o6zNrJbi8j+BNosPmZ9sM6WSkdKQ@mail.gmail.com>
I agree that Javadoc code shouldn't be a tutorial - that is why I also
proposed to delete the example completely. But I think the current example
is a little bit of anti-tutorial. To cite Josh Bloch - "Example code should
be exemplary. If an API is used widely, its examples will be the archetypes
for thousands of programs. Any mistakes will come back to haunt you a
thousand fold."

On Fri, 15 Nov 2019 at 18:04, Andrew Haley via Concurrency-interest <
[email protected]> wrote:

> 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
>

_______________________________________________
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.