Skip to content
Snippets Groups Projects
Commit 04be6c42 authored by Niccolò Betto's avatar Niccolò Betto
Browse files

[CanProtocol] Avoid copying messages when calling the receive callback

parent a6655ecf
Branches
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ namespace Canbus
CanProtocol::CanProtocol(CanbusDriver* can, MsgHandler onReceive,
miosix::Priority threadPriority)
: can(can), onReceive(onReceive), threadPriority(threadPriority)
: can(can), onReceive(std::move(onReceive)), threadPriority(threadPriority)
{
}
......
......@@ -47,7 +47,7 @@ namespace Canbus
*/
class CanProtocol
{
using MsgHandler = std::function<void(CanMessage data)>;
using MsgHandler = std::function<void(const CanMessage& data)>;
public:
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment