_dbus_write/read/poll etc and regular files
Rob Taylor
robtaylor@fastmail.fm
Mon Jan 17 09:57:18 PST 2005
On Mon, 2005-01-17 at 18:13 +0000, Tor Lillqvist wrote:
> Havoc Pennington writes:
> > Another approach maybe is:
> > typedef struct
> > {
> > DBusStreamType type; /* DBUS_STREAM_SOCKET, DBUS_STREAM_FILE, etc. */
> > int value;
> > } DBusStream;
> >
> > And have _dbus_poll (or _dbus_wait_for_multiple_streams()) take one of
> > those instead of just an fd... then in the win32 implementation could
> > you unpack which descriptors are files and which are sockets, and
> > construct a WaitForMultipleObjects() call that can wait on both at once?
>
> Yes but no ;-) It's more or less impossible to do select()-like wait
> on a random C file descriptor. Well, nothing is impossible of course,
> but it will take a lot of work and debugging, and the code will be
> rather differently structured from what's used on Unix. Restricting
> yourself to sockets makes for more elegant code, and increases code
> reuse and/or sharing of code paths with Unix.
>
Out of interest, in what problematic way is WaitForMultipleObjects not
select-like?
Rob Taylor
More information about the dbus
mailing list