Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Paho Embedded-C - consider making cycle() public or protected.

Making cycle() protected sounds like a good idea to me.

Also, maybe there's a case for another style of yield(): yield until an MQTT event occurs (or the timeout)?

Ian


On 02/23/2015 11:08 PM, Joe Planisky wrote:
Hi all,

In the current Paho embedded-C code, MQTT::Client::yield() will always take at least the specified time to return, regardless of whether there are any incoming messages or not.  It does this by calling Client::cycle() in a loop until the timer expires. Client::cycle() waits for and processes a single message and then returns to the caller.

I have a situation where I’m expecting one message in response to data my app has published, so I’d like to be able to continue my code as soon as that message comes in.  Currently, even if that message is waiting for me when I call yield(), I still have to wait the full timeout period.

I would like to be able to call Client::cycle() from my own code, directly or in a child class so that I don’t have to wait the full yield() time.  Unfortunately, Client::cycle() is declared private, so I can’t do that.  Any chance cycle() could be made protected or public to give user applications more control over how long they have to wait for messages?

—
Joe



_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

--
Ian Craggs
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto



Back to the top