Re: threads

On Wed, Aug 16, 2000 at 06:15:17PM +0200, Dr. Gerhard Dieringer wrote:
> I have the following problem: I want to controll a GTK-application with
> the IR remote controll 
> (IRRC) of my hauppauge tv card. My first solution was to write a
> function, that looks if a key
> was pressed on the IRRC and emit a 'clicked'-signal for the
> corresponding GTK-button-widget.
> The function is called via gtk_idle_add whenever GTK is idle. This
> solution works, but because
> the function is called ***very often***, I get a CPU-usage of 100%.

If notification comes by way of some sort of file handle, try using
an "input watcher" via gtk_input_add_full().

If not, could you check for the IRRC keypresses via a timeout instead of an
idle function?  That won't kill your CPU.

Or will keypresses be detected *only* when your code is explicitly
looking for them?  i.e. Will you drop events if you aren't constantly
checking.  If so, you have a problem...


GNU/Linux: Free your mind and your OS will follow.

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