Re: poll with timeout 0 in main loop



On Fri, 22 Oct 2010 02:57:59 +0000
Juan Pablo L. <jpablolorenzetti hotmail com> wrote:
hi, this is the code that makes the server socket
[snip]

There doesn't seem anything especially wrong with this but you have a
lot of code missing.  In particular, what does your
tcp_server_handle_connection_events() callback do, such as when it
encounters errors (you specify that the callback is to be entered in a
case of G_IO_NVAL and G_IO_ERR), and how do you disconnect sources from
the main loop when they are finished with (I notice also you don't
unref the sources after attaching them to the main loop).  Quite
possibly you are looping in a case of errors or defunct sources.

Probably the best thing you can do is come up with the smallest test
case which demonstrates the error (with say just one socket worker
thread) and post it here.

This is off topic, but glib's gio makes it trivial to construct new
server threads and it does all the hard stuff for you, but you need
glib version 2.22 for gio's socket API.  Glib's gio has no relationship
with GIOChannels, despite the similar names.

Chris



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