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/14/19 3:31 PM, Francesco Nigro via Concurrency-interest wrote:
> E o = this.obj;
> if (o == null && !done) {
> return null;
> }
> //o will be !null at some point
> do {
> if (o != null)
> return o;
> java.lang.Thread.onSpinWait();
> } while(true);
> }
>
> In case like this is more appropriate, maybe, but much less intuitive
> probably.
Umm, what? o is a local. This loop spins forever.
--
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