Re: Threads, sockets and windows



> But on windows there is no poll() function. Of course I can use
> g_async_queue, but doing so I can't poll queue and network socket
> simultaneously.
You can associate WSAEvents to your socket via WSAEventSelect and then
wait for the events to become signaled using WSAWaitForMultipleObjects.
Using a further event may be used to signal that new data is available
in the g_async_queue. Extended documentation to the mentioned functions
is available in the MSDN (http://msdn.microsoft.com).

A probably better approach would be to let glib poll your sockets via
creating GIOChannels and using g_io_add_watch to watch for events to
occur. This way, you could get completely rid of an extra networking
thread.

Attachment: signature.asc
Description: This is a digitally signed message part



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