From: matz@... (Yukihiro Matsumoto) Date: 1999-01-05T15:54:03+09:00 Subject: [ruby-talk:00164] Re: Thread Problems Hi. In message "[ruby-talk:00138] Thread Problems" on 98/12/22, Reimer Behrends writes: |I have been looking at the thread implementation of Ruby for the past |couple of days, and I think I may have found a few problems. | |For instance, io.c does a lot of checking to see if a thread can block. |Unfortunately, some of these checks are incomplete. For example, if you run |the following script, the forked thread blocks everything else as soon as |you hit enter until you type Ctrl-D. I inspect for the problem. In conclusion, as for 1.2, the script below works correctly. The read(2) (and fread(3)) blocks iff no data is supplied for the fd. In case specified length of data is available read(2) returns without blocking. Ruby thread system check every calls to read(2) to achieve non-blocking behavior. I guess it works well, as far as I know. If you have found any blocking problem, tell me about it. |fp = open("/dev/tty") | |Thread.start do | fp.read |end | |while true do | print "Looping.\n" | sleep 2 |end In previous version, ruby had a bug to block the script in `read' method of the IO class, I guess. I think I have fixed it in version 1.2 (sometime in 1.1). matz.