1 |
On 06/02/2012 02:31 PM, Michał Górny wrote: |
2 |
> On Sat, 2 Jun 2012 15:54:03 -0400 |
3 |
> Mike Frysinger <vapier@g.o> wrote: |
4 |
> |
5 |
>> # @FUNCTION: redirect_alloc_fd |
6 |
>> # @USAGE: <var> <file> [redirection] |
7 |
>> # @DESCRIPTION: |
8 |
> |
9 |
> (...and a lot of code) |
10 |
> |
11 |
> I may be wrong but wouldn't it be simpler to just stick with a named |
12 |
> pipe here? Well, at first glance you wouldn't be able to read exactly |
13 |
> one result at a time but is it actually useful? |
14 |
|
15 |
I'm pretty sure that the pipe has remain constantly open in read mode |
16 |
(which can only be done by assigning it a file descriptor). Otherwise, |
17 |
there's a race condition that can occur, where a write is lost because |
18 |
it's written just before the reader closes the pipe. |
19 |
-- |
20 |
Thanks, |
21 |
Zac |