On 27 August 2010 09:47, Chris Vine <[email protected]> wrote:
> On Thu, 26 Aug 2010 14:16:28 +0200
> Magnus Hjorth <[email protected]> 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
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to