Re: g_io_channel_win32_new_messages() & WaitForSingleObject()

Anyone know if you can use a win32 message io channel on arbitrary "handles"

Nope. It is just for window messages for the window indicated by the
HWND parameter.

Specifically, if I had "handle" returned from RegisterServiceCtrlHandler()
(which as best as I can imagine in my linux centric reality is some sort
alertable mutex like a futex) there are msdn examples showing
WaitForSingleObject() used as an alternative to "global variable polling".

I have never used that service control API, no idea what it is used for even...

But if MSDN says that the returned SERVICE_STATUS_HANDLE actually is a
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.

Unfortunately I don't actually know or understand the glib main loop
API very well by heart, so I can't say off-hand what you then should
do with such a GPollFD. Pass it to g_source_add_poll(), but for what
GSource? You might need to implement your own GSource type with
relevant callbacks to take care of that handle "firing", and then pass
such a GSource object to g_source_attach()? Sorry...


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