RE: poll with timeout 0 in main loop

2010-10-22 Thread Juan Pablo L .
Hi Chris, yes it works without setting it as non-blocking so i decided to leave none blocking just in case .. :) anyways i was preparing the test code to send to you guys but i discovered that in the test code the cpu usage is 0% (as i would expect in the real application) ... the code i

Re: poll with timeout 0 in main loop

2010-10-22 Thread Chris Vine
On Fri, 22 Oct 2010 13:53:55 +0100 Chris Vine wrote: > On Fri, 22 Oct 2010 10:37:01 + > Juan Pablo L. wrote: > > i attached the code but did not make thru, here is the server code: > > Something odd is going on. > > I see you are using GIOChannel not to do any reading, but in order to > no

Re: poll with timeout 0 in main loop

2010-10-22 Thread Chris Vine
On Fri, 22 Oct 2010 10:37:01 + Juan Pablo L. wrote: > i attached the code but did not make thru, here is the server code: Something odd is going on. I see you are using GIOChannel not to do any reading, but in order to notify you that a connection is available. poll()/select() of course sup

RE: poll with timeout 0 in main loop

2010-10-22 Thread Juan Pablo L .
i attached the code but did not make thru, here is the server code: GMTCPServer *tcp_server_new(const Configurations *p_configurations) { GMTCPServer *new_server; GError *error = NULL; int fd; // create a new tcp server object new_server = g_new(GMTCPServer,1); // get t

RE: poll with timeout 0 in main loop

2010-10-22 Thread Juan Pablo L .
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 co

Re: poll with timeout 0 in main loop

2010-10-22 Thread Chris Vine
On Fri, 22 Oct 2010 02:57:59 + Juan Pablo L. 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 w