The stupid question is the question not asked | |
PerlMonks |
Re: Re: Sleep has high cpu (sleep spins madly behind the scenes)by UnderMine (Friar) |
on Nov 09, 2002 at 12:25 UTC ( [id://211638]=note: print w/replies, xml ) | Need Help?? |
Some time ago I needed to have that kind of spinning (scanning large number of connections on a chat room for activity) but under low load, in the middle of the night, the same code killed the machine. I found using Time::HiRes to put a micro sleep inversely proportional to the number of active connections stopped the process from spinning out of control and allowed the OS to pre-empt the loop. Thanks UnderMine
In Section
Seekers of Perl Wisdom
|
|