How to shutdown the dir_monitor object in order to allow the io_service to exit the .run loop?
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.
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.