Skip to content

Commit

Permalink
Explicitly qualify atomic_wait and atomic_notify function calls
Browse files Browse the repository at this point in the history
Summary:
`std::atomic_wait()` and `std::atomic_notify_one()` are marked as unavailable.
Not really sure what that means, but it seems to be breaking some open source
builds facebook#1527.  Explicitly qualify the
calls into those functions to try and fix the build break.

Since we cannot conditionally import either of the above (because they are
marked as unavailable), we can't rely on the standard implementations.  To
prevent ADL from kicking in when the standard-library defines these, we fully
qualify these and use `tag_invoke` for the customization points used in tests.

Reviewed By: davidtgoldblatt

Differential Revision: D26742072

fbshipit-source-id: 9f44bbfd37530f5ecffa3e03d673cfb1df953299
  • Loading branch information
aary authored and dotconnor committed Mar 19, 2021
1 parent 9ace407 commit fdb9dda
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions folly/lang/CustomizationPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
namespace folly {

// Using 'auto' for non-type template parameters is only possible from C++17
#if __cplusplus >= 201703L
#if FOLLY_CPLUSPLUS >= 201703L

// cpo_t<CPO>
//
Expand All @@ -71,6 +71,6 @@ namespace folly {
template <const auto& Tag>
using cpo_t = std::decay_t<decltype(Tag)>;

#endif // __cplusplus >= 201703L
#endif // FOLLY_CPLUSPLUS >= 201703L

} // namespace folly
1 change: 0 additions & 1 deletion folly/synchronization/AtomicNotification-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ void atomic_notify_all_impl(const Atom<Integer, Args...>* atomic) {
});
}


template <typename Integer>
void tag_invoke(
atomic_wait_fn, const std::atomic<Integer>* atomic, Integer expected) {
Expand Down
2 changes: 1 addition & 1 deletion folly/synchronization/AtomicNotification.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct atomic_wait_fn {
constexpr inline auto atomic_wait =
detail::atomic_notification::atomic_wait_fn{};

// mimic: std::atomic_wait_until, p1135r0
// mimic: std::atomic_wait_until, p1135r0
namespace detail {
namespace atomic_notification {
struct atomic_wait_until_fn {
Expand Down

0 comments on commit fdb9dda

Please sign in to comment.