Hans boehm seems to busy with this:
https://www.youtube.com/watch?v=mrvAqvtWYb4&gl=BE
i


On Thu, Apr 24, 2014 at 9:47 AM, Steffen Heil (Mailinglisten) <lists@steffen-heil.de> wrote:
Hi


> You are right. Iterator holds a pointer to circular_buffer and accesses some of its internals.
> However it is safe to use only iterators and overwrite independent parts of circular_buffer. All the operations with iterators do not modify internals of circular_bufer.
> So if you change cb.erase_first(n)/cb.resize(cb.capacity()) to iterator operations there must be no problems. Though I thinks that's what you have done in case of custom vector-based data structure.

This might be a general C++ question and not be boost specific, but as I read the answer above the following question popped up:

If two threads read / write the same area in the memory and there is no synchronization, how is it ever guaranteed that they see the "current" values?
I see the problem, if one threads writes to a certain place in a buffer and another thread reads from that buffer, it might read cached values (either by the compiler keeping a value in a register or by the hardware keeping copies in cpu caches while the two threads run in different cpu cores / cpus).
So any kind of synchronization (that usually involves a memory barrier) is needed...

Coming from java there is a memory model that clearly specifies a "happens-before" relation. Values are guaranteed to be available if the operations in place are ordered according to that relation.
Is there any C++ specification for these things?
How much is it compiler / platform specific?


Regards,
  Steffen

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users