Boost logo

Boost :

Subject: Re: [boost] Fwd: [sync?] "Distributed" value (or something...)
From: Peter Dimov (lists_at_[hidden])
Date: 2014-07-30 05:36:24


Andrey Semashev wrote:
> The problem with the callbacks is that you have to choose the thread to
> invoke them in. In the simplest case this could be the writer thread, in
> other cases a separate thread pool might be more desirable.

I'd say that the problem with the callback architecture is that you still
need to communicate the change to the readers, which would require them to
still poll an atomic variable at the very least. And if they poll, there's
no need for callbacks. Just have the writer increment a version counter.
weak_ptr's would be slightly less performant because they do a CAS on lock,
instead of just an atomic read. I'm not sure if this would matter that much
though.


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