From: ara.t.howard@... Date: 2006-12-16T05:58:19+09:00 Subject: Re: Thread and sleep On Sat, 16 Dec 2006, Tim Pease wrote: >> I had this problem on a project a couple of years back and the >> conclusion of those who helped me from this group was that the io on >> stdin was blocking all threads other threads while the thread with the >> stdin io (gets) waited for input. I seem to recall someone saying that >> this prevented two or more threads from trying to read from stdio at >> the same time. Does this still ring true/correct? And the work around >> as I recall was to use a windows system call to check for input being >> ready before the thread tried to read from stdin so the others were >> blocked as little as possible. >> > > Yeah, it does look like the "gets" is causing the other thread to not > wake up from sleep. This is really odd, though, since the other thread > is just sleeping and not trying to do any IO whatsoever. Hmmm ... > maybe the puts and the gets are not playing well together? > > I use the gets line in little test applications to keep the thing > running until I hit enter. Then I do cleanup, etc. So it's nothing > mission critical, but it is very unexpected behavior. Possible bug? i bet it involves ruby's internal use of select for thread scheduling and diffent input methods generated by mvc++ vs. msys being responsible for dictating whether this blocks ruby or not. -a -- if you find yourself slandering anybody, first imagine that your mouth is filled with excrement. it will break you of the habit quickly enough. - the dalai lama