Skip to content
Commit 3379baeb authored by Marshall Clow's avatar Marshall Clow
Browse files

Change the control flow in atomic_compare_exchange_strong to avoid a potential deadlock.

When you assign a shared_ptr, the deleter gets called and assigned. In this routine, the assignment happens inside a critical section, which could (potentially) lead to a deadlock, if the deleter did something wonky. Now we swap the old value with an (empty) temporary shared_ptr, and then let the temporary delete the old value when it goes out of scope (after the lock has been released).  This should fix PR#27724. Thanks to Hans Boehm for the bug report and the suggested fix.

llvm-svn: 269965
parent 32173153
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment