// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later // // TODO: remove this file when jthread is supported by all compilation targets // #pragma once #include #include #include #include namespace Common { template bool StoppableTimedWait(std::stop_token token, const std::chrono::duration& rel_time) { std::condition_variable_any cv; std::mutex m; // Perform the timed wait. std::unique_lock lk{m}; return !cv.wait_for(lk, token, rel_time, [&] { return token.stop_requested(); }); } } // namespace Common