This is the mail archive of the cygwin mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I'm having a problem trying to script with fifos under the bash shell. There appears to be a race condition which results in a deadlock when fifos are being read and written in quick succession (but just a single read and write, so there are no interleaving issues). This code with an explicit delay before the write, running under bash 3.1.17(6)-release (on Cygwin1.dll 1.5.19), works as expected: ---8<--- ~/test-fifo$ mkfifo fifo ~/test-fifo$ ((sleep 1; echo foo >fifo)&); echo Read: $(<fifo) Read: foo --->8--- This code, with a delay before the read, also works: ---8<--- ~/test-fifo$ rm fifo ~/test-fifo$ mkfifo fifo ~/test-fifo$ ((echo foo >fifo)&); sleep 1; echo Read: $(<fifo) Read: foo --->8--- This code, without a delay, causes a deadlock and both active spawned bash processes (the forked one reading from the fifo and the backgrounded one) need to be killed explicitly: ---8<--- ~/test-fifo$ rm fifo ~/test-fifo$ mkfifo fifo ~/test-fifo$ ((echo foo >fifo)&); echo Read: $(<fifo) --->8--- I am not subscribed: please CC me if you reply. -- Barry -- http://barrkel.blogspot.com/
Attachment:
cygcheck.out
Description: Binary data
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |