Re: g_io_channel_read_chars vs.g_io_channel_read



On Mon, 2004-12-06 at 14:12 -0800, Scott Dattalo wrote:
> Point of reference:
> 
> $ pkg-config --modversion gtk+-2.0
> 2.2.1

That's a little bit old.

> g_io_channel_read_chars() is the designated replacement for the
> deprecated g_io_channel_read(). However, the two functions behave
> differently and I'm having trouble reconciling those differences.
> Specifically, the symptom is that g_io_channel_read_chars() blocks
> whereas g_io_channel_read() does not.

I don't have time to look through your mail in detail, but if
read_chars() is blocking when you ask for more bytes than are
available, that's not really suprising. 

While I think read_chars() can return a short read if you
ask for more than a buffer size (the docs for these functions
are absymal) generally it tries to give you all the characters
you asked for. Turning off buffering for the channel will
give you something much more like a raw UNIX read().

If you want non-blocking behavior on a buffered IO channel, you 
should set it non-blocking. If you actually get blocking on a channel
that you set to be non-blocking, please file a bug in bugzilla
with a short test case demonstrating the problem.

Regards,
						Owen

Attachment: signature.asc
Description: This is a digitally signed message part



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