This project has moved. For the latest updates, please go here.

SNMP Traps

Topics: bug report (break and fix)
Aug 7, 2008 at 8:52 AM
As mentioned in the other discussion thread, I have a question unrelated to the topic we were discussing over there...

I've noticed that when I call TrapListener.Start, my CPU usage skyrockets... I took a quick look at the code and can see why.  In TrapListener.cs, Worker.DoWork contains an "infinite" loop (as it should), but that loop has nothing in it to wait - so it's just looping as fast as it can doing "nothing", but still consuming CPU to do it.

Adding a simple System.Threading.Thread.Sleep(200) in there is an effective "poor man's solution", and is what I've done until I have more time up my sleeve, but probably something more elegant than this should be considered.
Aug 8, 2008 at 3:16 AM
You may call Sleep if you meet such an issue. I am going to add Sleep to latest build, too.
Sep 11, 2008 at 7:12 AM
After reading this interesting post, I think now a simple call to Sleep is not optimal. I will update #SNMP TrapListener again to incorporate the best practice.

Sep 13, 2008 at 4:44 AM
I have applied this tip in the latest Change Set.

Marked as answer by lextm on 10/6/2013 at 9:45 PM