diff options
| author | lizzie <lizzie@eden-emu.dev> | 2026-02-11 03:00:15 +0100 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-02-11 03:00:15 +0100 |
| commit | 19494bc7ac943478e099f1b28877d33ece685d3f (patch) | |
| tree | 2cf52c459067d05a7ccb2a11169d46e7a9e7e7b1 /src/tests | |
| parent | 28a78d76fed94255233284abb3df36b3fd41467d (diff) | |
[network, qt] use jthread and use std::vector for packet list instead of std::list (#254)
Signed-off-by: lizzie <lizzie@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/254
Reviewed-by: DraVee <dravee@eden-emu.dev>
Reviewed-by: Maufeat <sahyno1996@gmail.com>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src/tests')
| -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]") { |
