[cpp-threads] Prism 0.9.1, and further on the effects of races

Jeremy Manson jmanson at cs.umd.edu
Tue Sep 12 19:17:41 BST 2006


Herb Sutter wrote:

> Thoughts?

Not necessarily a thought on C++, but I thought it would be worth 
pointing out that we had the conversation about (A) for Java. 
Basically, it wasn't much of a problem for us, because all memory in 
Java is zeroed out before allocation.  So all we needed to do was 
perform a memory barrier and try again in the case of a 
NullPointerException.

Hypothetically, you could try to apply this to C++.  If your new() 
implementation zeroes memory, for example, this would work.

That doesn't really solve (B), of course.  Although you could change the 
semantics slightly:

a) say that if you share an object via a data race, you don't 
necessarily invoke the right method, because the object may not be fully 
constructed, and

b) if the pointer is /actually/ garbage, and you get a bus error, retry.

I don't know if that is even faintly realistic, though.

					Jeremy



More information about the cpp-threads mailing list