Boost logo

Boost :

Subject: Re: [boost] [lockfree review] rfc: naming and interface
From: Tim Blechmann (tim_at_[hidden])
Date: 2011-07-25 04:27:40


> >> - fail/overwrite/wait on overflow, fail/wait on underflow
> >
> > is `overwrite' reasonable? and there would be quite a number of options,
> > how to wait: spin, spin-and-yield(), wait for semaphore (it there were a
> > boost.semaphore), wait for condition variable
>
> Yes overwrite is reasonable. Imagine real-time data like the
> accelerometer/magnetometer of a cell phone. The most recent data can
> overwrite the oldest because typically the most recent is most
> important (ie which way is the phone facing *now*) and then maybe some
> recent history data (to detect gestures), but the oldest data can be
> thrown away.

ok ... `overwrite' will only reasonably work for the mpmc queue (and there it is
more a `node stealing'). the stack implementation has no way to find the oldest
element, and the spsc queue (aka ringbuffer) cannot implement it correctly
because the produce thread would need to modify the index, which can only be
modified from the consumer thread.

cheers, tim




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk