Subject: Re: [boost] [lockfree] how many items are queued?
From: Tim Blechmann (tim_at_[hidden])
Date: 2009-09-05 03:47:01
> What's IMHO the correct response for empty(), size(), and other (non-
> thread-safe) functions is to document explicitly:
> bool empty() const;
> // Return whether a *snapshot* of this queue is empty.
> size_t size() const;
> // Return a *snapshot* of the size of this queue.
i see your point, but i doubt, it can be implemented correctly (at least
with double-word cas primitives).
the only possibility, that i see, is providing methods for upper and
lower bounds using atomic integers that are incremented/decremented
before/after the linearization points ... i will see, maybe it is
possible to provide this facility based on template arguments. i don't
want to add this to the default interface, since atomic operations
require some hardware synchronization, which aren't really lightweight ...
-- tim_at_[hidden] http://tim.klingt.org You don't have to call it music if the term shocks you. John Cage
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk