Possible bug in atomicOp

Sean Kelly sean at invisibleduck.org
Tue Oct 26 10:16:24 PDT 2010


Sean Kelly Wrote:

> Don Wrote:
> > 
> > Wait a minute. x86 has no read-modify-write instructions for x87, or for 
> > SSE. So I don't think it's possible to implement atomic floating-point 
> > ops, apart from assignment.
> > (Of course, you can fake it with a mass of casts and a CAS, but that 
> > doesn't seem helpful).
> > It should just be prevented, except possibly for assignment. (Is an 
> > 80-bit float assignment atomic? Maybe not, since it would need special 
> > logic).
> 
> atomicOp does most of its RMW operations using a CAS loop, so I think it should work.  The redo occurs when the memory location being written to changed since it was read, and that shouldn't be any different for floating point values vs. integers.

ref: http://dsource.org/projects/druntime/browser/trunk/src/core/atomic.d#L127


More information about the Digitalmars-d mailing list