Is your feature request related to a problem? Please describe.
Actually, when we call the recv_frame(const atomic_bool&, function<void(GlobalFrame)> function from a Protocol, the reception is closed when the running_execution: atomic_bool& flag is set to false.
However, the underlying called recv_frame function is still blocking so the library's user needs to send a frame (even empty) to go out of the receiving function and so stop the receiver thread.
Describe the solution you'd like
All the receiving process should be hidden for the user and so the only called to running_execution.exchange(false) should properly close all communication threads, without to use the client.send_frame({}); hack.
Describe alternatives you've considered
This functionality would be implemented inside the AbstractSerialProtocol::recv_frame() function: at the end of the while(runnin_execution) {...} loop, we could call a killer handler implemented in each protocol as a function<void(void)> signatured function.
It could also be done by using a shared_ptr<AbstractSerialProtocol> _killer_client, in the case we can interrupt all protocols by only sending an empty frame on this client.
Is your feature request related to a problem? Please describe. Actually, when we call the
recv_frame(const atomic_bool&, function<void(GlobalFrame)>
function from aProtocol
, the reception is closed when therunning_execution: atomic_bool&
flag is set tofalse
.However, the underlying called
recv_frame
function is still blocking so the library's user needs to send a frame (even empty) to go out of the receiving function and so stop the receiver thread.Describe the solution you'd like All the receiving process should be hidden for the user and so the only called to
running_execution.exchange(false)
should properly close all communication threads, without to use theclient.send_frame({});
hack.Describe alternatives you've considered This functionality would be implemented inside the
AbstractSerialProtocol::recv_frame()
function: at the end of thewhile(runnin_execution) {...}
loop, we could call a killer handler implemented in each protocol as afunction<void(void)>
signatured function.It could also be done by using a
shared_ptr<AbstractSerialProtocol> _killer_client
, in the case we can interrupt all protocols by only sending an empty frame on this client.