Re: Solved Gtk::Gdk->input_add



On 09/02/00 John McDermott wrote:

Thanks to those who responded privately.  
The answer appears to have to do with SIGALARM.  I had a handler for
SIGALARM for a portion of the code written before it was ported to gtk. 
It seems that input_add returns when a SIGALARM runs.  I solved the
issue by doing the Right Thing: using Gtk->timeout_add and Gtk->timeout
remove.  The code is cleaner and it has run reliably for 18 hours (in
contrast to about one second) so I suspect that the problem is fixed.

I don't understand how timeout_add could be a clean substitute
for input_add. What you probably want to check is the last arg to
your handler:

Gtk::Gdk->input_add($fileno, ['read'], sub {
        my $condition = pop @_;
        if ($condition->{read}) {
                # it's safe to read
        }
});

lupus

-- 
Paolo Molaro, Open Source Developer, Linuxcare, Inc.
+39.049.8043411 tel, +39.049.8043412 fax
lupus linuxcare com, http://www.linuxcare.com/
Linuxcare. Support for the revolution.




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