qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Stitcher <astitc...@redhat.com>
Subject Re: Review Request: Provides the EventNotifier type, plus example agent and unit test.
Date Mon, 22 Aug 2011 20:54:46 GMT
Sorry for replying to myself, but sometimes curiosity just gets the
better of me...

On Mon, 2011-08-22 at 16:45 -0400, Andrew Stitcher wrote:
> On Mon, 2011-08-22 at 16:37 -0400, Darryl L. Pierce wrote:
> > On Mon, Aug 22, 2011 at 12:46:43PM -0500, Steve Huston wrote:
> > > FWIW, WSAPoll is not available on XP; it was introduced at Vista.
> > 
> > But the SOCKET type, which is used by WSAPoll as well as pre-existing
> > functions to retrieve data from a socket, does. And since what we're
> > looking for is what the appropriate return type on Windows should be,
> > I'm planning to do:
> > 
> > #ifdef WIN32
> > #include <winsock2.h>
> > typedef SOCKET QMF_IO_HANDLE;
> > #else
> > typedef int QMF_IO_HANDLE;
> > #endif
> 
> Can you use the winsock SOCKET type as a general windows HANDLE? ie is
> it valid as an input to WaitForMultipleObjects()? If you can then SOCKET
> is good enough for integration into an applications main loop if not
> then it isn't sufficient.

After some googling it seems that Winsock SOCKETs are really not
equivalent in the way you want to Unix file descriptors and can't in
themselves be used in the same sort of places. But you can create a
windows HANDLE from a SOCKET by using WSAEventSelect() but you need to
know what event (read/write/etc.) you want the HANDLE triggered for.

In any event the simple #ifdef scheme above is not very useful in the
real world.

Andrew



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Mime
View raw message