Re: Glib g_io_channel_read: can't be called deprecated



"Dmitry M. Shatrov" <zzidre mail ru> writes:

> Hello.
>
> Why g_io_channel_read is called "deprecated" in glib docs?
> Here's why I think this is wrong:
>
>
> I need to do some IPC through named fifo's (those created with mkfifo).
> Confused by docs, I at first used g_io_channel_read_chars with NULL
> encoding,
> as according to documentation it is "safe for binary data".
>
> I expect that after calling g_io_channel_flush () on writer's side the
> reader
> will likely to receive all pending data throug g_io_channel_read_chars,
> but it does not receive anything, cus read_chars tries to gather
> the full buffer before it returns - such behavior is OK if I read from
> a file
> and is absolutely unexpected if I read from a fifo channel.
>
> The only way to do what I described is to use g_io_channel_read,
> which is implemented the way it should be: it returns partial data
> immediately
> if there is any.

Just use g_io_channel_set_buffered (channel, FALSE);

ciao,
--mitch



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