Re: Solved Gtk::Gdk->input_add

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:

Actually, timout_add was a substitute for using a SIGALARM handler and a
timer set to expire every 1000 ms.  It was initially done "outside of"
gtk and ran correctly.  By bringing it inside the gtk api it now works
correctly with all versions.

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


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