On May 19, 2011, at 11:11 PM, Nick Lewycky wrote:
> I've started dipping my toes in the libcxxabi project by implementing a few 
> simple methods. Patch attached, please review!
> 
> This isn't heavily tested, I'm mostly just trying to make sure I have the 
> style down. Please let me know if we should be using different file names 
> (hard to follow a pattern where there isn't one), of if the private methods 
> in cxa_guard actually belong in an anonymous namespace, etc.

Guard variables need to support recursive initialization:  the initialization
of one variable must be able to kick off arbitrary code that might perform
its own initialization.  In C++11, there's a guarantee that this won't deadlock
even if the first initialization blocks on a different thread.

Probably the most reasonable way to handle this is to have a global lock
which is *not* held during initialization, and a global condition variable
that threads wait on if they're waiting for somebody else to perform an
initialization.

John.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to