This is an archive of the discontinued LLVM Phabricator instance.

[TSan][Darwin] Avoid calling pthread_self() before libpthread is initialized
ClosedPublic

Authored by yln on Dec 16 2019, 10:55 AM.

Details

Summary

This skips calling pthread_self when main_thread_identity hasn't
been initialized yet. main_thread_identity is only ever assigned in
__tsan::InitializePlatform. This change should be relatively safe; we
are not changing behavior other than skipping the call to pthread_self
when main_thread_identity == 0.

rdar://57822138

Event Timeline

yln created this revision.Dec 16 2019, 10:55 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 16 2019, 10:55 AM
Herald added subscribers: llvm-commits, Restricted Project, jfb. · View Herald Transcript
kubamracek accepted this revision.Dec 16 2019, 12:20 PM
This revision is now accepted and ready to land.Dec 16 2019, 12:20 PM
This revision was automatically updated to reflect the committed changes.