< :the previous in number
^ :the list in numerical order
> :the next in number
P :the previous (in thread)
N :the next (in thread)
|<:the top of this thread
>|:the next thread
^ :the parent (reply-to)
_:the child (an article replying to this)
>:the elder article having the same parent
<:the youger article having the same parent
---:split window and show thread lists
| :split window (vertically) and show thread lists
~ :close the thread frame
.:the index
..:the index of indices
In article <33120.192.168.2.102.1107793208.squirrel / 192.168.2.102>,
"Caleb Tennis" <caleb / aei-tech.com> writes:
> The program hangs on the read() call - if I run the same program above and
> perform the "SerialPort.new.write()" call without making a new thread, the
> code works fine. I performed an strace, with some interesting results -
> namely, that for the multithreaded application I don't ever see a call to
> the system's read/write, just select. The above code works fine for
> regular files - it just seems to have trouble with device files.
>
> Is this a bug or am I just missing something?
It seems that write buffer should be flushed before select for reading.
Index: io.c
===================================================================
RCS file: /src/ruby/io.c,v
retrieving revision 1.246.2.71
diff -u -p -r1.246.2.71 io.c
--- io.c 25 Jan 2005 04:02:27 -0000 1.246.2.71
+++ io.c 8 Feb 2005 12:46:54 -0000
@@ -236,14 +236,12 @@ rb_io_check_readable(fptr)
if (!(fptr->mode & FMODE_READABLE)) {
rb_raise(rb_eIOError, "not opened for reading");
}
-#if NEED_IO_SEEK_BETWEEN_RW
if (((fptr->mode & FMODE_WBUF) ||
(fptr->mode & (FMODE_SYNCWRITE|FMODE_RBUF)) == FMODE_SYNCWRITE) &&
!feof(fptr->f) &&
!fptr->f2) {
io_seek(fptr, 0, SEEK_CUR);
}
-#endif
fptr->mode |= FMODE_RBUF;
}
--
Tanaka Akira