[Python-Dev] Forking and pipes (original) (raw)
Alexander Shigin shigin at rambler-co.ru
Tue Dec 9 20:35:16 CET 2008
- Previous message: [Python-Dev] Forking and pipes
- Next message: [Python-Dev] Forking and pipes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
В Втр, 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'.
- Previous message: [Python-Dev] Forking and pipes
- Next message: [Python-Dev] Forking and pipes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]