Stop processCommand high CPU use

Bug: 442400
This commit is contained in:
Ian Craggs 2014-08-26 11:30:36 +01:00
parent e3e40d1787
commit 6c7112b229
1 changed files with 5 additions and 0 deletions

View File

@ -1260,7 +1260,12 @@ thread_return_type WINAPI MQTTAsync_sendThread(void* n)
int rc;
while (commands->count > 0)
{
int before = commands->count;
MQTTAsync_processCommand();
if (before == commands->count)
break; /* no commands were processed, so go into a wait */
}
#if !defined(WIN32) && !defined(WIN64)
rc = Thread_wait_cond(send_cond, 1);
if ((rc = Thread_wait_cond(send_cond, 1)) != 0 && rc != ETIMEDOUT)