GH-118095: Make sure that progress is made if there are pending calls being handled. - #118484
Conversation
ericsnowcurrently
left a comment
There was a problem hiding this comment.
This makes sense. I have but one key question.
There was a problem hiding this comment.
Does this mean that only the thread that was already handling pending calls will handle any remaining ones (until the queue is empty)? Currently the next available thread handles the remaining ones, so no single thread is blocked too long handling pending calls.
There was a problem hiding this comment.
Currently, the next available thread keeps tripping the eval breaker until the current call is handled, so the _PY_CALLS_TO_DO_BIT is in effect blocking.
A non-blocking and fair mechanism would be good, but the current mechanism is neither.
This makes it non-blocking, although maybe less fair.
There was a problem hiding this comment.
That's fine. We can circle back to a fair mechanism later, if someone cares enough.
… calls being handled. (pythonGH-118484)

#118286 makes the assumption that
_Py_HandlePending()will clear the eval_breaker, if not on the first call, then eventually.However, this isn't true for pending calls.
This PR makes sure that
_Py_HandlePending()does eventually clear the eval_breaker.