mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
input_common/udp: std::move SocketCallback instances where applicable
std::function is allowed to heap allocate if the size of the captures associated with each lambda exceed a certain threshold. This prevents potentially unnecessary reallocations from occurring.
This commit is contained in:
parent
fb9c9ddcc9
commit
5c61e0ba39
1 changed files with 2 additions and 2 deletions
|
@ -206,7 +206,7 @@ void TestCommunication(const std::string& host, u16 port, u8 pad_index, u32 clie
|
||||||
Common::Event success_event;
|
Common::Event success_event;
|
||||||
SocketCallback callback{[](Response::Version version) {}, [](Response::PortInfo info) {},
|
SocketCallback callback{[](Response::Version version) {}, [](Response::PortInfo info) {},
|
||||||
[&](Response::PadData data) { success_event.Set(); }};
|
[&](Response::PadData data) { success_event.Set(); }};
|
||||||
Socket socket{host, port, pad_index, client_id, callback};
|
Socket socket{host, port, pad_index, client_id, std::move(callback)};
|
||||||
std::thread worker_thread{SocketLoop, &socket};
|
std::thread worker_thread{SocketLoop, &socket};
|
||||||
bool result = success_event.WaitFor(std::chrono::seconds(8));
|
bool result = success_event.WaitFor(std::chrono::seconds(8));
|
||||||
socket.Stop();
|
socket.Stop();
|
||||||
|
@ -266,7 +266,7 @@ CalibrationConfigurationJob::CalibrationConfigurationJob(
|
||||||
complete_event.Set();
|
complete_event.Set();
|
||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
Socket socket{host, port, pad_index, client_id, callback};
|
Socket socket{host, port, pad_index, client_id, std::move(callback)};
|
||||||
std::thread worker_thread{SocketLoop, &socket};
|
std::thread worker_thread{SocketLoop, &socket};
|
||||||
complete_event.Wait();
|
complete_event.Wait();
|
||||||
socket.Stop();
|
socket.Stop();
|
||||||
|
|
Loading…
Reference in a new issue