diff options
Diffstat (limited to 'src/tests/input_common/calibration_configuration_job.cpp')
| -rw-r--r-- | src/tests/input_common/calibration_configuration_job.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/tests/input_common/calibration_configuration_job.cpp b/src/tests/input_common/calibration_configuration_job.cpp index d67d1cbbb4..6ded0dfc86 100644 --- a/src/tests/input_common/calibration_configuration_job.cpp +++ b/src/tests/input_common/calibration_configuration_job.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project @@ -22,13 +22,9 @@ public: : socket(io_context, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 0)) {} ~FakeCemuhookServer() { - is_running = false; boost::system::error_code error_code; socket.shutdown(boost::asio::socket_base::shutdown_both, error_code); socket.close(); - if (handler.joinable()) { - handler.join(); - } } u16 GetPort() { @@ -45,10 +41,9 @@ public: sizeof(InputCommon::CemuhookUDP::Message<InputCommon::CemuhookUDP::Response::PadData>); REQUIRE(touch_movement_path.size() > 0); - is_running = true; - handler = std::thread([touch_movement_path, this]() { + handler = std::jthread([touch_movement_path, this](std::stop_token stoken) { auto current_touch_position = touch_movement_path.begin(); - while (is_running) { + while (!stoken.stop_requested()) { boost::asio::ip::udp::endpoint sender_endpoint; boost::system::error_code error_code; auto received_size = socket.receive_from(boost::asio::buffer(receive_buffer), @@ -91,8 +86,7 @@ private: boost::asio::ip::udp::socket socket; std::array<u8, InputCommon::CemuhookUDP::MAX_PACKET_SIZE> send_buffer; std::array<u8, InputCommon::CemuhookUDP::MAX_PACKET_SIZE> receive_buffer; - bool is_running = false; - std::thread handler; + std::jthread handler; }; TEST_CASE("CalibrationConfigurationJob completed", "[input_common]") { |
