On Sat, Nov 24, 2007 at 01:07:53PM -0500, Uri Guttman <[EMAIL PROTECTED]> wrote:
> another event loop that needs proper wrapping is wx. i found that it

I had a relatively cursory look at Wx. Indeed, not only can't I see any
way to add ones own fds, Wx apperently equates "socket" with "tcp v4
socket", as nothing else seems to be supported.

I don't know the rationale for this, but here's my take at it: Wx, like
many other programs, want to support unix and unfortunately have to
support windows, too.

As windows doesn't have the generic I/O model of unix, the smallest common
denominator is indeed the windows way, where each I/O channel has different
functions, which lends itself to a socket class that wraps around
the OS functions.

That way, you can support sockets in a platform-independent way, but of
course you have no generality at all.

Perl itself goes a slightly different route, with basically the same
result (but at least it could be improved): Perl emulates the generic unix
model (usually by using the fd model provided by msvcrt), wraps select
etc. but then "fails" to support anything besides sockets.

Both models support sockets only, but the perl model of course is
theoretically extendable: one *could* provide wrappers around pipes and other
sources, but that gets very slow (as seen in cygwin), and tedious, especially
if the OS itself doesn't really support the operation and you have to work
around.

For example, many I/O channels have no notion of readyness under windows, so
the while "tell me when I can read data" model falls down.

Glib for example also works around this by providing a windows-like model
without readyness events (which can be efficiently emulated under unix,
fortunately), doing its own I/O buffering and then faking its own readyness
events on top of it, again providing something like the unix model, by
totally reimplementing the windows I/O. And it also fails for many event
sources.

So, with Wx, it looks bleak: Wx doesn't even seem to have the notion of
file descriptors, so you lost.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      [EMAIL PROTECTED]
      -=====/_/_//_/\_,_/ /_/\_\

Reply via email to