В Втр, 09/12/2008 в 19:26 +0000, Lars Kotthoff пишет:
> Dear list,
> 
>  I recently noticed a python program which uses forks and pipes for
> communication between the processes not behaving as expected. The minimal
> example program:

If you write 
====
r, w = os.pipe()
os.write(w, 'foo')
pid = os.fork()
====

You'll get the same result as C program. Or if you use fdopen in C
program you'll get the same result as Python.

The problem with the example is libc buffering. If you say
write.flush(), buffer won't be shared with child process and you'll see
only one 'foo'.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to