Re: Event and CPU usage while idle

[email protected] (Joshua N Pritikin) Sat, 9 Feb 2002 08:15:32 +0530
Newsgroups perl.loop
Message-ID <[email protected]>
On Fri, Feb 08, 2002 at 03:37:17PM -0500, Colin Murtaugh wrote:
> I'm trying to use Event.pm to do some pretty basic event handling
> (watching for incoming data on a named pipe, and eventually some timers)
> but I keep having trouble with CPU usage.  Seems that once the loop
> starts, my script uses all available cpu.  The script I'm using to test
> with is below.  What am I doing wrong?

My guess is that files are always readable whether there is new data or not.
Instead you should poll for new data every fraction of a second, similar
to "tail -f".

--
Victory to the Divine Mother!!         after all,
  http://sahajayoga.org                  http://why-compete.org