asio
asio copied to clipboard
Doesn't post'ing from ~awaitable_thread() break any guarantees?
This stems from quite exotic case where 2 io_service's can't be safely destroyed after calling stop().
https://stackoverflow.com/q/73517163/85371
As I see it, instead of just destroying handlers (and releasing resources) ~awaitable_thread() tries to initiate a new operation.
According to documentation the executor is indeed invalid: "An executor becomes invalid when the first call to ctx.shutdown() returns".
I wonder if it's a valid behavior in general case? What if io_service is being destroyed because of exception? IIRC ASIO puts a lot of effort to behave correctly (i.e. propagate or otherwise handle) when exceptions are thrown.