There is a contract for the use of a named pipe. I will suppose un*xlike and to simplify I will not talk about non-blocking. For pipes the
default is blocking.
You need a reader and usually the reader is a long-running process.
The reader will block on read as soon as it opens.
If there is no reader any writer will block.
Remember it *is* a pipe so what gets in must get out...
If you write more than a certain maximum number of bytes input is likely to be intermixed between the writers.
If the reader does not process the input quickly enough then eventually a writer will be blocked and then all the other writers, so you need some flow analysis or special janitor processes.
So do you have a permanent reader? If you have a read-once reader
the behavior you seem to be experiencing is *normal*.
Can it be somehow that the pipe is opened by the two threads?
Can you check with lsof or similar the processes that maintain a descriptor opened to the named pipe.
If you had posted some code we might have been able to help better.
% steph@ape (/home/stephan) %
% cat reader.sh
#!/bin/ksh
trap 'exit 0' INT
pipe=named_pipe outfile=out
[[ -p $pipe ]] || mkfifo $pipe
exec 0<$pipe
while dd if=$pipe bs=64 count=1 >> $outfile
do
print .processing
sleep 2
done
% steph@ape (/home/stephan) %
% jobs
[1] + Running ./reader.sh &
cheers --stephan