Re: Socket i/o from within Gtk::main()?
| From: | Yermo Lamers | Date: | Sun, 27 Aug 2006 00:35:01 +0000 |
| Subject: | Re: Socket i/o from within Gtk::main()? | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-7118@lists.php.net to get a copy of this message | ||
> This is mainly due to the fact that PHP does not support multi-
> threading, and that
> means Gtk::main() blocks pretty much everything.
There should be no reason that a single event loop shouldn't suffice,
especially on modern hardware.
In the C/C++ API this facility seems to be there, even in the single
threaded case:
http://www.gtk.org/api/2.6/glib/glib-IO-Channels.html
We just need an equivalent. Provide a socket descriptor somewhere and have
it be added to the main event loop .. when there's input have it make a
callback. It would be plenty fast in this context.
If, however, you're forced to poll a socket from a timer callback, then I
can see how it would be impractical to write an IM client in PHP. It would
never be fast enough.
----------------------------------------------------------------------------
DTLink Software http://www.dtlink.com
Business and Finance Software Engineering
----------------------------------------------------------------------------