this is almost the complete code. you can see all the flow here.
basically, the main.c starts the server thread (gm_tcp_server), inside the 
server thread the application sits waiting for new connection, just sitting 
waiting consumes 100% of the CPU (without accepting any connection yet), the 
code of the server is in file gm_tcp_server.c. the rest of the code is just in 
case you need it for reference.

thanks!

> Date: Fri, 22 Oct 2010 10:17:30 +0100
> From: ch...@cvine.freeserve.co.uk
> To: jpablolorenze...@hotmail.com
> CC: maginot.jun...@gmail.com; gtk-app-devel-list@gnome.org
> Subject: Re: poll with timeout 0 in main loop
> 
> On Fri, 22 Oct 2010 02:57:59 +0000
> Juan Pablo L. <jpablolorenze...@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
                                          
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to