[PATCH] D21609: [tsan] Intercept libcxx __release_shared to avoid false positive with weak_ptrs and destructors in C++

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 23 07:42:26 PDT 2016


dvyukov added a comment.

You are right.

Then we can try:

  Mutex shared_ptr_sync[kSomePrime];
  
  Mutex *mtx = &shared_ptr_sync[hash(o) % kSomePrime];
  mtx.Lock();
  Acquire(thr, pc, o);
  Release(thr, pc, o);
  SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_START();
  REAL(_ZNSt3__119__shared_weak_count16__release_sharedEv)(o);
  SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_END();
  mtx.Unlock();

But I am scared by potential consequences of running user code under internal mutex...


http://reviews.llvm.org/D21609





More information about the llvm-commits mailing list