[AGENT++] callback function for receive() ?

Jochen Katz katz at agentpp.com
Thu Jun 12 23:27:10 CEST 2008


Hi,

> I integrate the agent++/snmp++ package into a existing Windows 
> application. This application is a non-preemptives Multitasking-System. 
> SNMP handling is only a subtask.

> So I have the problem that my software hangs in the receive loop and my 
> snmp thread never will be left.

> Is there any alternative to implement the receive() functionality e.g. 
> as a callback function which only called when a request received ?

a callback function would require a new thread that does the 
reqList->receive() call. You could implement such a thread wthin your 
application.

> As a quick solution I poll the receive() function every second but this 
> makes the responce time very slowly.

If you change the following line in RequestList::receive() it is 
possible to call reqList->receive(0) as often as you can, without 
running at 100% CPU time:
		tvptr->tv_usec = 1000;

Regards,
   Jochen



More information about the AGENTPP mailing list