dir_monitor icon indicating copy to clipboard operation
dir_monitor copied to clipboard

How to shutdown the dir_monitor object in order to allow the io_service to exit the .run loop?

Open jdmairs opened this issue 8 years ago • 1 comments

If you take the example test program test_running.cpp and add a asio/signal_set handler to trap Ctrl-C there doesn't appear to be a way to remove the async_monitor operation thus io_service.run() never exits.

In my application our Ctrl-C handler gracefully tells all asio io_objects (timers, sockets) to "shutdown". Then the io_service exits once all the handlers have executed and the program drops out of the bottom of main.

Even calling remove_directory in the Ctrl-C handler appears to keep the work on the queue.

jdmairs avatar Nov 07 '17 21:11 jdmairs

Hmm, I'm pretty sure you can just stop monitoring the directories and it should not add any work if it's not doing anything.

I need to refresh my memory though, it's been a while.

berkus avatar Dec 09 '17 07:12 berkus