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 with blocking I/O in python.It is reproduced by the program below. When I run it on cygwin, it prints "About to read fifo..." then "About to write regular file..." then hangs. Ctrl-C and Ctrl-Z don't kill it - I've had to kill it with Task Manager.
For comparison, I've run it on a couple of Ubuntu boxes, and it prints "About to read fifo..." then "About to write regular file..." then "Finished writing regular file." then it exits normally.
If anyone can shed some light on why this is happening, I'd appreciate it. Output of "cygcheck -s -v -r" is attached. #!/usr/bin/env python import sys, os, tempfile, threading, time tmpdir = tempfile.mkdtemp() def write_regular_file(): print 'About to write regular file...' try: filename = os.path.join(tmpdir, 'regular-file') with open(filename, 'w') as fout: fout.write('file contents') finally: print 'Finished writing regular file.' def create_and_read_fifo_in_separate_thread(): fifo_filename = os.path.join(tmpdir, 'fifo') os.mkfifo(fifo_filename) def run(): print 'About to read fifo...' with open(fifo_filename) as fin: fin.read() # This will never print, even if the test is successful: print 'Finished reading fifo.' thread = threading.Thread(target=run) thread.daemon = True thread.start() if __name__ == '__main__': create_and_read_fifo_in_separate_thread() time.sleep(1) write_regular_file()
Attachment:
cygcheck.out
Description: Text document
-- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |