RE: poll with timeout 0 in main loop
- From: Juan Pablo L. <jpablolorenzetti hotmail com>
- To: <chris cvine freeserve co uk>
- Cc: gtk-app-devel-list gnome org
- Subject: RE: poll with timeout 0 in main loop
- Date: Fri, 22 Oct 2010 10:31:39 +0000
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: chris cvine freeserve co uk
To: jpablolorenzetti hotmail com
CC: maginot junior 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. <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]