Answer the question
In order to leave comments, you need to log in
How to correctly terminate a child thread that is waiting for an operation to complete?
Pseudocode of a child thread that waits for data and sends messages to the main thread upon receiving this data, how to terminate it correctly if the main thread has received a completion message? I feel a lack of knowledge, maybe something to read? In general, I use boost:: asio and I want cross-platform.
while(true)
{
some_monitor.async_monotor(callback_handler);
io_service.run();
io_service.reset();
}
void callback_handler(data d)
{
if (d == STOP)
{
running = false;
}
}
...
while(running)
{
some_monitor.async_monotor(callback_handler);
io_service.run();
io_service.reset();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question