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

Re: Idle func -> 100% CPU usage




On Mon, 28 Jun 1999, Gert wrote:
> I use have a Tcl interpreter running in a gtk application, and because I want
> the Tcl event loop running, I connect a function with gtk_idle_add, that runs
> Tcl_ServiceAll(); and then returns TRUE;
> This, however, results in a 100% CPU usage for my program :(
>

Well, an idle function runs continuously whenever Gtk is doing nothing, so
obviously it will use 100% CPU. :-)
 
> Is there a way to decrease this?
> 

I can't think of anything intelligent to say without knowing more about
Tcl. But clearly an idle function isn't what you want. You need to figure
out a way to know when there are Tcl events (when you run a command? when
there's activity on a certain file descriptor?). Then you run the Tcl loop
when you get the Tcl events.

Havoc




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