Re: examples/thread_usage.pl



> muppet <scott asofyet org> wrote:
>
On Sunday, January 11, 2004, at 11:43 AM, Ross McFarland wrote:

have a look. comments/questions/problems let me know.

ok...  you use an idle at default priority...  this will leave the main
thread nearly pegging the processor.

the two easiest options: give the idle a lower priority (which is a higher number), or use a timeout instead.
...

Just a data point: I couldn't find a priority value that didn't peg my cpu. Anyone have different results? I'm probably doing something wrong.

I changed

Glib::Idle->add (sub { ... });

to

Glib::Idle->add (sub { ... }, 1, $priority);

Where $priority was one of (1, 100, 200, 250, 300, 1000);

I either got no GUI (widgets never drawn; priority too low: 1, 100), or a working GUI and a pegged cpu (everything else).

The cpu usage drops as soon as the main loop quits.

<Joe





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]