This is an archive of the discontinued LLVM Phabricator instance.

[tsan] For OS X thread finalization, remove g_thread_finalize_key in favor of libpthread hooks
ClosedPublic

Authored by kubamracek on Nov 18 2015, 7:55 AM.

Details

Summary

On OS X, the thread finalization is fragile due to thread-local variables destruction order. I've seen cases where the we destroy the ThreadState too early and subsequent thread-local values' destructors call interceptors again. Let's replace the TLV-based thread finalization method with libpthread hooks. The notification PTHREAD_INTROSPECTION_THREAD_TERMINATE is called *after* all TLVs have been destroyed.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek updated this revision to Diff 40510.Nov 18 2015, 7:55 AM
kubamracek retitled this revision from to [tsan] For OS X thread finalization, remove g_thread_finalize_key in favor of libpthread hooks.
kubamracek updated this object.
kubamracek added reviewers: dvyukov, samsonov, glider, kcc.
dvyukov accepted this revision.Nov 19 2015, 1:39 AM
dvyukov edited edge metadata.
This revision is now accepted and ready to land.Nov 19 2015, 1:39 AM
This revision was automatically updated to reflect the committed changes.