[PATCH] D21609: [tsan] Intercept libcxx __release_shared to avoid false positive with weak_ptrs and destructors in C++
Kuba Brecka via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 23 07:44:57 PDT 2016
kubabrecka added a comment.
In http://reviews.llvm.org/D21609#465566, @dvyukov wrote:
> 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...
Can we unlock before calling the user code? It sounds to me we just need the Acquire+Release to be atomic.
http://reviews.llvm.org/D21609
More information about the llvm-commits
mailing list