// Copyright (c) 2011-present, Facebook, Inc. All rights reserved. // This source code is licensed under both the GPLv2 (found in the // COPYING file in the root directory) and Apache 2.0 License // (found in the LICENSE.Apache file in the root directory). #pragma once #include #include #include #include namespace folly { namespace detail { namespace atomic_notification { /** * We use Futex as the alias that has the lowest performance * overhead with respect to atomic notifications. Assert that * atomic_uint_fast_wait_t is the same as Futex */ static_assert(std::is_same>{}, ""); /** * Implementation and specializations for the atomic_wait() family of * functions */ inline std::cv_status toCvStatus(FutexResult result) { return (result == FutexResult::TIMEDOUT) ? std::cv_status::timeout : std::cv_status::no_timeout; } inline std::cv_status toCvStatus(ParkResult result) { return (result == ParkResult::Timeout) ? std::cv_status::timeout : std::cv_status::no_timeout; } // ParkingLot instantiation for futex management extern ParkingLot parkingLot; template