However some calls like io_service.run(); are blocking the program until "all work is done" which in my case means that it runs infinitely until the program/console is being closed.
The problem I having here is that the program doesn't properly when I close it. I would expect him to return from the blocking function and finish the main function to get to the return 0; statement.
But he never gets there, the console window gets closed and the mentioned code part is never accessed. Instead he quits with this code:
has exited with code -1073741510 (0xc000013a).
Now besides the fact I want him to exit properly I also need him to access some code after the blocking function since I need to cleanup some objects (as well as closing files).
I was hoping someone could give me a hint how to solve this problem or tell me if there is some way to know when the console window gets closed so I can signal the blocking call that he has to stop blocking.