process hangs when writing large data to pipe

后端 未结 1 1991
轮回少年
轮回少年 2021-01-22 04:27

I have a problem with hung processes with my Perl program, and I think I have isolated it to whenever I write significant amounts of data to a pipe.

Below is all of the

1条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-22 05:09

    You probably shouldn't be ignoring your pipe while it is returning data: you can use a select on the pipe (instead of waitpid) to see if there's any data to read during your waiting loop, but if you really want a larger pipe buffer so you can read it all at once, you can use a socketpair instead of a pipe and then you can use setsockopt to make the buffer as large as you need it.

    0 讨论(0)
提交回复
热议问题