Cleanup condition check for a quick poll.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com> Change-Id: Ica75605d3a12e7eae86cc0e4cbebb722aef92919pull/8165/merge
parent
f8a0d6c086
commit
d4d4731136
|
@ -2682,9 +2682,7 @@ int KitSocketPoll::kitPoll(int timeoutMicroS)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
int realTimeout = timeoutMicroS;
|
int realTimeout = timeoutMicroS;
|
||||||
if (_document &&
|
if (_document && _document->needsQuickPoll())
|
||||||
(_document->hasCallbacks() ||
|
|
||||||
(_document->hasQueueItems() && _document->processInputEnabled())))
|
|
||||||
realTimeout = 0;
|
realTimeout = 0;
|
||||||
|
|
||||||
if (poll(std::chrono::microseconds(realTimeout)) <= 0)
|
if (poll(std::chrono::microseconds(realTimeout)) <= 0)
|
||||||
|
|
10
kit/Kit.hpp
10
kit/Kit.hpp
|
@ -328,6 +328,16 @@ public:
|
||||||
bool hasQueueItems() const { return _queue && !_queue->isEmpty(); }
|
bool hasQueueItems() const { return _queue && !_queue->isEmpty(); }
|
||||||
bool hasCallbacks() const { return _queue && _queue->callbackSize() > 0; }
|
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 ?
|
// poll is idle, are we ?
|
||||||
void checkIdle();
|
void checkIdle();
|
||||||
void drainQueue();
|
void drainQueue();
|
||||||
|
|
Loading…
Reference in New Issue