The pseudo code of the child thread that waits for data and sends message to the main thread to obtain this data, as it correctly terminate if the main thread received a message on completion? Feel the lack of knowledge and maybe something to read? Do use boost::asio and I want cross-platform support.
while(true)
{
some_monitor.async_monotor(callback_handler);
io_service.run();
io_service.reset();
}
If I understand correctly, the io_service.run() — then I wait until the system notifies my thread and I have no other ways to complete this but himself(the child thread) to send the data to signal completion?
void callback_handler(data d)
{
if (d == STOP)
{
running = false;
}
}
...
while(running)
{
some_monitor.async_monotor(callback_handler);
io_service.run();
io_service.reset();
}
Blagodaru in advance.