[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: your mail

William Morgan

2/8/2005 3:27:00 AM

Excerpts from Caleb Tennis's mail of 7 Feb 2005 (EST):
> As soon as I do something this:
>
> Thread.new do
> response = SerialPort.new.write("/dev/tts/5, [some_array_of_bytes])
> end
>
> The thread hangs at the read() function. If I use the same code in the
> main thread it works fine.

This might be related to [ruby-talk:109668] [ruby-talk:125125], in which
Ruby's switch to select() over read() in the presence of Threads can
cause freezes under kernel 2.6. But maybe not; the behavior there is
slightly different.

Can you post an strace?

--
William <wmorgan-ruby-talk@masanjin.net>


2 Answers

Caleb Tennis

2/8/2005 12:01:00 PM

0

On Monday 07 February 2005 22:27, William Morgan wrote:
> This might be related to [ruby-talk:109668] [ruby-talk:125125], in which
> Ruby's switch to select() over read() in the presence of Threads can
> cause freezes under kernel 2.6. But maybe not; the behavior there is
> slightly different.
>
> Can you post an strace?

I posted an strace under [ruby-talk:130019], and it shows that indeed select()
is being used in the thread and is causing the hang.

I've been able to work around the problem by switching to sysread() and
syswrite() in my class.

Thanks,
Caleb


William Morgan

2/8/2005 12:49:00 PM

0

Excerpts from Caleb Tennis's mail of 8 Feb 2005 (EST):
> I posted an strace under [ruby-talk:130019], and it shows that indeed
> select() is being used in the thread and is causing the hang.
>
> I've been able to work around the problem by switching to sysread()
> and syswrite() in my class.

Interesting. In my experiments with files on /proc, sysread() still
results in a hanging select() system call. Wonder why it works for you.

--
William <wmorgan-ruby-talk@masanjin.net>