Re: Infinite Loop with Glib::IO->add_watch()
- From: "A. Pagaltzis" <pagaltzis gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: Infinite Loop with Glib::IO->add_watch()
- Date: Wed, 8 Sep 2004 20:09:22 +0200
* Mike Schilli <m perlmeister com> [2004-09-08 19:52]:
Gotcha. One other related question: In the examples, I
somewhere found the notion
Gtk2::Helper->add_watch(fileno(READHANDLE), 'in', \&callback);
instead of
Glib::IO->add_watch(fileno(\*READHANDLE), 'in', \&callback);
Are these equivalent or do you prefer one or the other?
I didn't know about Gtk2::Helper::add_watch so far. The
Gtk2::Helper doc is unhelpfully monosyllabic:
This method is a wrapper for Glib::IO->add_watch. The
callback is called every time when it's safe to read from or
write to the watched filehandle.
Looking at the source, it seems to be a Gtk1.x compatibility
layer:
# In Gtk 1.x the callback was called also for the eof() /
# pipe close events, but Gtk 2.x doesn't. We need to connect
# to the G_IO_HUP event also to get this convenient behaviour
# again.
That's all it does other than punting calls through to
Glib::IO::add_watch. It's either meant for porting old programs
that rely on the Gtk1.x behaviour, or as a convenience wrapper.
In any case, you should probably just use Glib::IO::add_watch if
you don't need that behaviour.
Regards,
--
Aristotle
"If you can't laugh at yourself, you don't take life seriously enough."
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]