Python program using os.pipe and os.fork() issue

后端 未结 4 775
花落未央
花落未央 2020-12-14 12:07

I\'ve recently needed to write a script that performs an os.fork() to split into two processes. The child process becomes a server process and passes data b

4条回答
  •  一生所求
    2020-12-14 12:11

    I see you have solved the problem of blocking i/o and buffering.

    A note if you decide to try a different approach: subprocess is the equivalent / a replacement for the fork/exec idiom. It seems like that's not what you're doing: you have just a fork (not an exec) and exchanging data between the two processes -- in this case the multiprocessing module (in Python 2.6+) would be a better fit.

提交回复
热议问题