Re: Coding a console program frontend



Hi,

However the child proccess (the GUI) when tries to read data from the pipe
it hangs. If you run this program you can see that the printf( "BEFORE READ
LINE\n" ) is printed but the printf( "AFTER READ LINE\n" ) is not..

What I'm doing wrong?

What do you means with *hang*? or it's being unresponsive?, the g_io_channel_* family functions use a 
GIOFuncs, defined at giochannel.h each for it's I/O operation, with g_io_channel_read_line you can see they 
are basically a read() syscall wrapper, see g_io_unix_read in giounix.c. In blocking state. You can't see 
printf("AFTER LINE\n") because g_io_channel_read_line is blocking your process and also it's GTK+ main loop, 
with blocked main loop, your GUI is being unresponsive and not updated through it's main loop.

With g_io_channel_read_line you have to make sure the sender send a terminating character, because it will 
read until the terminating character reached, and maybe this made the block. Why not try with 
g_io_channel_read_chars? you can try to set number of bytes to read there? ... a simple debug heh ;)

                       - Ardhan


_____________________________________________________________
Listen to KNAC, Hit the Home page and Tune In Live! ---> http://www.knac.com



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