Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 10 months ago.
mqtt yield broken?
I am trying to write an application for my Nucleo F746ZG, which uses two MQTT topics (in/out), to have a persistent communication with my server, so I checked out the HelloMQTT code, and modified it slightly, to have an infinite loop, but thats not really working because:
yield blocks for about a minute, instead 100ms, and after about a minute it stops receiving any messages, but only blocks for about 1s
loop
static int loopCounter = 0; set_time(0); time_t lastTime = time(NULL); while (true){ logMessage("loop: %d\r\n",++loopCounter); client.yield(100); time_t seconds = time(NULL); int diff = seconds -lastTime; logMessage("time diff: %d\r\n",diff); lastTime = seconds; //send messages queued by other thread if(!outQueue.empty()){ ... } }