[llvm-commits] [PATCH] LockedManagedStatic

Owen Anderson resistor at mac.com
Mon Jun 15 10:16:55 PDT 2009


Here's my next proposal for the long-term goal of making LLVM thread- 
safe.  The concept here is to create a new subclass of  
ManagedStaticBase, LockedManagedStatic.  These objects pair a mutex  
with the object that they're guarding, and hook the mutex up to be  
initialized automatically when llvm_start_multithreaded() is called.

This does have slight overhead in that it adds a pointer to  
ManagedStaticBase.  This could probably be avoided by adding another  
class to the hierarch (LockedManagedStaticBase?), but that seemed  
overly complex for fairly small benefit.

Comments welcome!

--Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: threading.diff
Type: application/octet-stream
Size: 6331 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090615/2445932d/attachment.obj>


More information about the llvm-commits mailing list