This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Only declare contents of threading API when _LIBCPP_HAS_THREAD_API_EXTERNAL is not defined.
ClosedPublic

Authored by DavidSpickett on Aug 21 2019, 2:16 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

DavidSpickett created this revision.Aug 21 2019, 2:16 AM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added subscribers: jfb, christof. · View Herald Transcript
michaelplatings requested changes to this revision.Aug 21 2019, 6:55 AM

It looks like if _LIBCPP_HAS_THREAD_API_PTHREAD is defined then with this change you'll be missing everything between lines 115 and 210.

This revision now requires changes to proceed.Aug 21 2019, 6:55 AM
DavidSpickett updated this revision to Diff 216400.EditedAug 21 2019, 7:54 AM

Addressed Michael's comment by not moving the initial:
#endif // defined(_LIBCPP_HAS_THREAD_API_PTHREAD)

Instead adding a separate block with:
#if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
further down.

So that these things are still present with pthreads.

mclow.lists accepted this revision.Aug 21 2019, 8:18 AM

This seems to work for me (pthreads and nothreads).
In general, I think we're playing "whack-a-mole' with this chunk of code, and I've become fairly unhappy with it.

I'll be doing some cleanup here after the release goes out.

This revision was not accepted when it landed; it landed in state Needs Review.Aug 21 2019, 8:38 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2019, 8:38 AM
EricWF reopened this revision.Aug 21 2019, 5:58 PM

I don't fully understand this patch. The point of always declaring the interface was to enforce that it matches exactly what we expect. I'll grant that probably wasn't working, but can you explain more about?

michaelplatings accepted this revision.Aug 22 2019, 1:16 AM

I can see that this patch doesn't make much sense in isolation. This patch plus D66480 make an alternative to D66301. Hopefully the explanation in D66301 makes it clear that we're merely restoring previous behaviour.

This revision is now accepted and ready to land.Aug 22 2019, 1:16 AM
This revision was automatically updated to reflect the committed changes.