[AGENT++] Re: Problems with asynchronous get...

Jochen Katz katz at agentpp.com
Wed Nov 24 21:42:55 CET 2004


Hi,

> Well, after checking the code a bit more, it looks like
> snmp->eventListHolder->SNMPProcessPendingEvents() has to be called in order
> to get your callback function called.

correct.

> The strange thing is that there is
> EventListHolder::SNMPProcessEvents(), EventListHolder::SNMPMainLoop(), and
> even EventListHolder::SNMPExitMainLoop() that should do this kind of work,
> but they where never used in the snmp++ code at all.

snmp++ does not use an internal thread, so it's up to the user to call 
these functions when he thinks it's the right time to call one of them 
and a suitable timeout value should be passed.

> So, if I loop 10 times around the
> snmp->eventListHolder->SNMPProcessPendingEvents(), I do get back results
> through the callback function. But, it looks like quite a waste of cycles
> and I can't stop to wonder if there is a better way to do this.

SNMPProcessPendingEvents() immediately returns if nothing is to do. You 
can use SNMPProcessEvents(1000), which will sleep up to 1000 ms.

Regards,
   Jochen



More information about the AGENTPP mailing list