Re: g_io_channel_win32_new_messages() & WaitForSingleObject()



normal HANDLE and a waitable one even, that can be passed to
WaitForSingleObject() and friends, then it should work to use it as
the "fd" in a GPollFD.

typedef struct {

#if defined (G_OS_WIN32) && GLIB_SIZEOF_VOID_P == 8
 gint64 fd;
#else
 gint           fd;

ok so on windows fd here is a pointer to a handle,

Not a pointer to a HANDLE, but a HANDLE as such. (And it must be a
waitable handle.)

not the rutime lib's lookup table's integer index...

You mean the C library's "file descriptors"? Indeed not. To use them,
you need to use g_io_channel_win32_new_fd(). (Which then creates a
GIOChannel, not a GPollFD. And it works only if your code uses the
same C library as GLib does, normally msvcrt.dll.)

any ideas what the revents mask should be?

G_IO_IN I think.

Very interesting. So presumably on windows poll() is really something like
WaitForMultiple*()?

Exactly. Check in gpoll.c.

Which would mean what - a prepare that always returns
FALSE w/ *timeout_ = 0, and a check that does what it what otherwise do if
WaitForSingleObject() returned hot?

It's best to experiment, as I said I don't recall the details by
heart... and too busy to actually check now.

--tml



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