chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.81k stars 1.2k forks source link

Enable interrupts to be work again after poll() has been called. #1288

Closed blackbox-tech closed 1 year ago

blackbox-tech commented 1 year ago

I would like to merge this change because I have a custom event loop that calls poll() whenever the reactor is interrupted. However, because poll() does not reset task_interrupted_ after it has run the task, posting events to the io_context from another thread does not interrupt the io_context like calling run() or wait() does.

I hope its an acceptable bug fix, as this change is essentially making the behavior of poll() match the state change that read() and wait() make, although I accept my use case integrating asio inside an external event-loop is a bit unusual.

blackbox-tech commented 1 year ago

Ignore, this fix it does not help as task_cleanup always sets task_interrupted_ back to true anyway.