[concurrency-interest] AutomicBoolean toggleAndGet()
gkorland at gmail.com
Fri Feb 12 11:34:52 EST 2010
Leaving aside the fact that it completes the AtomicX API.
toggleAndGet() is a more natural to concurrent algorithms that are based on
a toggle bit. E.g. diffracting tree, counting network & etc.
On Fri, Feb 12, 2010 at 6:19 PM, Martin Buchholz <martinrb at google.com>wrote:
> AtomicBoolean.toggleAndGet() does seem plausible,
> although no obvious use case occurs to me.
> But it doesn't buy you much.
> Besides a cas loop on AtomicBoolean,
> you could also use
> (atomicInteger.incrementAndGet() & 0x1) == 0
> so without more motivation
> I'd be inclined to leave it out.
> On Fri, Feb 12, 2010 at 06:59, Guy Korland <gkorland at gmail.com> wrote:
> > Hi,
> > AtomicBoolean.toggleAndGet() and getAndToggle()
> > It seems like a very usable feature to add to AtomicBoolean and something
> > that matchs the other AtomicX classes API (incrementAndGet).
> > Is there any reason why this class was discriminated?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest