[phobos] Fwd: Re: Ruling out arbitrary cost copy construction?

Robert Jacques sandford at jhu.edu
Mon Nov 1 14:49:09 PDT 2010


On Mon, 01 Nov 2010 15:53:51 -0400, David Simcha <dsimcha at gmail.com> wrote:
> I can't remember the reference off the top of my head, but I think inc  
> [EAX]
> w/o the lock prefix is atomic for weak definitions of atomic, i.e. it  
> has no
> intermediate states.  However, without the lock prefix it is not
> sequentially consistent.

Well, inc[EAX] is not multi-thread safe on my PC (Core i7), and every  
article I've seen mentions the lock instruction. So I think lock; inc int  
ptr [EAX]; is the only way to ensure all increments are seen. Also,  
inc[EAX] is not implicitly a integer, but instead a byte.
 


More information about the phobos mailing list