[AGENT++] Async processing
Arun
akumars at omnesysindia.com
Sat Jan 22 18:49:44 CET 2005
Jochen Katz wrote:
>> And then again while stepping into the code, i think i noticed a
>> Sleep being called in win32 implementation. Why is a Sleep required
>> in an Async setup ?
>
>
> It's there to have the same "delay" for WIN32 and other systems. If
> you do "while (true) SNMPProcessPendingEvents();" on Unix you will get
> a CPU usage of 0%. For WIN32 without the sleep you will get 100%.
On all systems i intend to do a
while (true)
{
SNMPProcessPendingEvents();
DoSomeTimeSensiveRepetetiveTask();
if (required)
{
Sleep(precalculated-time);
}
}
Having a Sleep within the SNMPProcesspendingEvents makes my loop have a
minimum resolution of 1 sec, wheras at times i might not want to sleep
at all. I can easily prevent the 100% CPU time by having a Sleep within
my loop itself. Morover i can control the type/resolution of my sleep,
depending on the real-time system conditions.
I guess i could simply remove the Sleep from SNMP++ code and recompile
it for my use, but if there was some way to do handle this in a standard
manner, within the library iself, i would have preferred that.
Thanks,
Arun
More information about the AGENTPP
mailing list