Re: ORBit2 on Win32



Michael Meeks wrote:
> On Wed, 2002-09-18 at 17:03, Karl Waclawek wrote:
> > I believe one can create a non-visible window for internal purposes.
> > Is that illegal for services too? Looks like a hack, admittedly.
> 
>         :-) sounds ugly

It's illegal for services.

>         I was hoping that 'g_poll' - the internal version of poll for Windows
> used by glib would work for us:
> 
> http://cvs.gnome.org/bonsai/cvsblame.cgi?file=glib/glib/gmain.c&rev=&root=/cvs/gnome
> 
>         Anyway, that seems to use WaitForMultipleObjects

WaitForMultipleObjects() is fine, but doesn't scale to large numbers
of sockets.  (Indeed, it has a limit of 64 objects.)

If you're worried about scalability, and are on WinNT or later,
you should use GetQueuedCompletionStatus().  This scales well to tens of
thousands of sockets.  (To use it, you have to register the socket with
a completion port, and use overlapped I/O, but all that could easily
be hidden behind the glib facade.)  We do this where I work; we have
a wrapper library which uses sigio on Linux, GetQueuedCompletionStatus()
on WinNT, and WaitForMultipleObjects() on Win95.  It can indeed handle
tens of thousands of connections, and works even when run as a service,
I think.

Which brings up the question: should glib be updated to use sigio
on Linux where available?  I suppose if anyone is trying to use it
to write servers, yes.
- Dan



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