Re: GIOChannel & Intercepting stdout



On 27 August 2010 09:47, Chris Vine <chris cvine freeserve co uk> wrote:
> On Thu, 26 Aug 2010 14:16:28 +0200
> Magnus Hjorth <magnus i hjorth gmail com> wrote:
>> Is the buffer really that small? I made a simple test program (below)
>> to check this out, and it seems that writes up to 64K work without
>> blocking on my Ubuntu system. Of course, it is still ugly (and
>> non-portable) to depend on this.
>
> I am extremely surprised that it is as large as 65536 in your case.
> POSIX requires PIPE_BUF to be at least 512, and on most unix-like
> systems it is 4096.

PIPE_BUF is the size of an guaranteed atomic write, not the pipe size.
 Also it is not specified that the os can't do other buffering as
well, just like it does for disk devices.  But it is also not
specified that it has to.  So knowing when you might block is *very*
system dependent.  Better not to depend on it.

Cheers
Lex

>
> It is pretty astonishing that your example does not block.
>
> Chris
>
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>


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