[cfe-dev] [cxxabi] Thread-safe statics causing deadlocks

Craig, Ben via cfe-dev cfe-dev at lists.llvm.org
Thu Jul 21 07:25:57 PDT 2016


On 7/21/2016 4:27 AM, David Chisnall wrote:
> I believe that the text of the standard is fine, however. The 
> implementation does not introduce deadlocks, the user code introduces 
> deadlocks.
The code snippets provided run without deadlocks if thread-safe statics 
are disabled.  There are also no user-level data races.  The standard 
seems pretty clear to me that this behavior isn't allowed.

I think that C++ code is better with the per-object locks in place, but 
the standard is unclear on what is considered allowable behavior.  I 
believe the standard permits a global lock, or a per-object lock, or 
something in between.  The implementation choice affects what is valid 
user code.  My "highly contrived" example wouldn't deadlock with a 
single global lock implementation, but the "lightly contrived" example will.

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project




More information about the cfe-dev mailing list