Cleanup condition check for a quick poll.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ica75605d3a12e7eae86cc0e4cbebb722aef92919
pull/8165/merge
Michael Meeks 2024-05-09 17:26:37 +01:00 committed by Caolán McNamara
parent f8a0d6c086
commit d4d4731136
2 changed files with 11 additions and 3 deletions

View File

@ -2682,9 +2682,7 @@ int KitSocketPoll::kitPoll(int timeoutMicroS)
do
{
int realTimeout = timeoutMicroS;
if (_document &&
(_document->hasCallbacks() ||
(_document->hasQueueItems() && _document->processInputEnabled())))
if (_document && _document->needsQuickPoll())
realTimeout = 0;
if (poll(std::chrono::microseconds(realTimeout)) <= 0)

View File

@ -328,6 +328,16 @@ public:
bool hasQueueItems() const { return _queue && !_queue->isEmpty(); }
bool hasCallbacks() const { return _queue && _queue->callbackSize() > 0; }
/// Should we get through the SocketPoll fast to process queus ?
bool needsQuickPoll() const
{
if (hasCallbacks())
return true;
if (hasQueueItems() && processInputEnabled())
return true;
return false;
}
// poll is idle, are we ?
void checkIdle();
void drainQueue();