Why don't named pipes respect the order at which readers were attached?
0
votes
1
answer
60
views
I have this test script:
#!/usr/bin/env bash
fif="foooz"; rm "$fif" ; mkfifo "$fif"
( cat "$fif" | cat && echo "1") &
sleep 0.1
( cat "$fif" | cat && echo "2") &
sleep 0.1
( cat "$fif" | cat && echo "3") &
echo "first" > "$fif"
wait;
the output I get is varied, I these varieties:
first
1
----
first
2
----
first
1
2
----
first
3
my question is - why doesn't the order at which readers are attached to the named pipe matter/respected? Seems lame that it's almost random?
Asked by Alexander Mills
(10734 rep)
Jun 5, 2019, 12:50 AM
Last activity: Jun 5, 2019, 03:20 PM
Last activity: Jun 5, 2019, 03:20 PM