Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: zmedico@g.o, Brian Harring <ferringb@×××××.com>
Subject: Re: [gentoo-dev] multiprocessing.eclass: doing parallel work in bash
Date: Sun, 03 Jun 2012 07:15:20
Message-Id: 20120603091522.4c0ee5a6@pomiocik.lan
In Reply to: Re: [gentoo-dev] multiprocessing.eclass: doing parallel work in bash by Zac Medico
1 On Sat, 02 Jun 2012 18:04:41 -0700
2 Zac Medico <zmedico@g.o> wrote:
3
4 > #!/usr/bin/env bash
5 > named_pipe=$(mktemp -d)/fifo
6 >
7 > (
8 > # hold the pipe open in read mode, so
9 > # the writer doesn't block
10 > sleep 3
11 > ) < "$named_pipe" &
12
13 I don't understand this part. This keeps the pipe open for reading
14 which obviously causes it to lose data. If you open it, you need to
15 read all that is there and then close.
16
17 And writers are supposed to be blocked. They are forked and just write
18 when done, so there's no problem with keeping them alive for a short
19 while.
20
21 --
22 Best regards,
23 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies